alecthomas / devtodo2

DevTodo the Second
100 stars 18 forks source link

GO111MODULE=off #44

Open kfirufk opened 11 months ago

kfirufk commented 11 months ago

by reading https://stackoverflow.com/questions/36650052/golang-equivalent-of-npm-install-g

I noticed this:

As of Go 1.11.1, setting GO111MODULE=off works to circumvent this behavior:

GO111MODULE=off go get github.com/usr/repo

i'm on go 1.21.4, i needed to use it both for installing kingpin globally and for running make because the default now is to check for go.mod locally unless this is set to off.

i'm not really sure if it's common knowledge maybe it's worth mentioning in the readme.

# go get gopkg.in/alecthomas/kingpin.v2
go: go.mod file not found in current directory or any parent directory.
    'go get' is no longer supported outside a module.
    To build and install a command, use 'go install' with a version,
    like 'go install example.com/cmd@latest'
    For more information, see https://golang.org/doc/go-get-install-deprecation
    or run 'go help get' or 'go help install'.
# make
go build -o todo2 todo.go view.go consoleview.go legacyio.go jsonio.go main.go importer.go
main.go:26:2: no required module provides package gopkg.in/alecthomas/kingpin.v2: go.mod file not found in current directory or any parent directory; see 'go help modules'
make: *** [Makefile:12: todo2] Error 1
alecthomas commented 11 months ago

The repo probably just needs go mod init run on it.