lithammer / shortuuid

:mushroom: A generator library for concise, unambiguous and URL-safe UUIDs

Home Page:https://pkg.go.dev/github.com/lithammer/shortuuid/v4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cannot find package "github.com/lithammer/shortuuid/v3"

mrcomac opened this issue · comments

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?

What version of Go are you using and what's the output of go env?

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"

I found the problem. I was trying with the GO111MODULE=off

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"
 )