cannot find package "github.com/lithammer/shortuuid/v3"
mrcomac opened this issue · comments
Marcos commented
Hello
I tried the example on README:
package main
import (
"fmt"
"github.com/lithammer/shortuuid/v3"
)
func main() {
u := shortuuid.New() // Cekw67uyMpBGZLRP2HFVbe
}
When I run:
go get -t -v ./...
I got this error:
github.com/lithammer/shortuuid (download)
cannot find package "github.com/lithammer/shortuuid/v3" in any of:
/usr/local/go/src/github.com/lithammer/shortuuid/v3 (from $GOROOT)
/home/marcos/go/src/github.com/lithammer/shortuuid/v3 (from $GOPATH)
but the package is available in: /home/marcos/go/src/github.com/lithammer/shortuuid
what was my mistake?
Peter Lithammer commented
What version of Go are you using and what's the output of go env
?
Marcos commented
Hi!
go version:
go version go1.16 linux/amd64
and go env output:
go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/marcos/.cache/go-build"
GOENV="/home/marcos/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/marcos/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/marcos/go/"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build852140369=/tmp/go-build -gno-record-gcc-switches"
Marcos commented
I found the problem. I was trying with the GO111MODULE=off
Peter Lithammer commented
Great! I'm gonna close this because I'm reluctant to spend time supporting GO111MODULE=off
. But I suspect that you could maybe just change the import path like this to get it working:
import (
"fmt"
- "github.com/lithammer/shortuuid/v3"
+ "github.com/lithammer/shortuuid"
)