The go tool works well if you use package import path as arguments. On Wednesday, 11 March 2020 20:49:53 UTC+1, Dean Schulze wrote: > > Well here's what I get in my module with a single directory with a single > file with a single package called lib: >
To be concrete let the module name be dean.schulz/awsome and containing one folder lib containing package lib. With this setup the import path of this package lib is dean.schulz/awsome/lib > > $ go install lib > can't load package: package lib is not in GOROOT > (/home/dean/bin/go1.14.linux-amd64/go/src/lib) > Try cd' _into_ the lib folder and either $ go install $ go install dean.schulz/awsome/lib > If I add the pwd to my GOPATH (the way things worked before modules) I get: > > $ go install lib > $GOPATH/go.mod exists but should not > It is either GOPATH or go modules. Don't try mixing stuff. If I remove the go.mod file and give it the relative path to a source file > it works but doesn't install anything: > $ go install src/lib/conf.reader.go > Again: Most subcommands of the go tool work best if invoked with the "import path" of a package. The import path with modules is formed like this: <full-module-name>/<relative-path-to-package-folder-inside-module-root> What works very well too is cd'ing into the folder and calling build, install, test, etc _without_ any arguments. V. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/b52999b5-ec7c-4b1d-847c-51b618efc9ad%40googlegroups.com.