devtodo2 icon indicating copy to clipboard operation
devtodo2 copied to clipboard

GO111MODULE=off

Open kfirufk opened this issue 2 years ago • 1 comments

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

kfirufk avatar Dec 05 '23 15:12 kfirufk

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

alecthomas avatar Dec 08 '23 08:12 alecthomas