Well here's what I get in my module with a single directory with a single file with a single package called lib:
$ go install lib can't load package: package lib is not in GOROOT (/home/dean/bin/go1.14.linux-amd64/go/src/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 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 On Wednesday, March 11, 2020 at 12:43:01 PM UTC-6, Bryan C. Mills wrote: > > `go install` does the same thing that it always has: it installs compiled > binaries and object files, not module source code. (A module may contain > multiple packages and multiple binaries.) > > See https://blog.golang.org/using-go-modules for a higher-level > introduction, and note that https://golang.org/doc/code.html is now > written for module mode rather than GOPATH mode. > > On Wed, Mar 11, 2020 at 2:33 PM Dean Schulze <dean.w...@gmail.com > <javascript:>> wrote: > >> Well, that was going to be my next question (how do I install a module >> from a local git repo or directory). >> >> If I understand you correctly go modules require a remote git repo, even >> if they are used only one machine. That should be made clear in the docs. >> >> Modules get cached locally in $GOPATH/pkg/mod, but in my module directory >> of I do >> >> go install lib/conf.reader.go >> >> it completes without errors, but I don't get a binary or source code file >> anywhere under $GOPATH/pkg/mod (or anywhere else I can see). >> >> Does go install work differently with modules? >> >> On Wednesday, March 11, 2020 at 9:22:46 AM UTC-6, Bryan C. Mills wrote: >>> >>> On Tuesday, March 10, 2020 at 5:47:45 PM UTC-4 dean.w....@gmail.com >>> wrote: >>> >>>> This blog entry <https://blog.golang.org/publishing-go-modules> uses >>>> git tags. It didn't mention branches. Are tags the only way to declare a >>>> version number? >>>> >>> >>> Yes, tags are the way to declare a version. >>> Generally branches represent ongoing development: further commits may be >>> added without changing the branch name. >>> In contrast, each version of a Go module must refer to one specific, >>> unchanging copy of the code. >>> (That is important both for security and for reproducibility.) >>> >>> Also, what if my git repo is local to my laptop? I'd think I should >>>> still be able to publish versioned modules to my local GOPATH from my >>>> local >>>> git repo. >>>> >>> >>> See https://golang.org/issue/28835, but in general we do not expect >>> users to need version selection for modules that are not published beyond a >>> single host. >>> >>> (But note that you can always set up a local HTTP server using the remote >>> import path <https://golang.org/cmd/go/#hdr-Remote_import_paths> protocol, >>> and use a local DNS entry and the GOPRIVATE environment variable to tell >>> the Go command where to find the repo.) >>> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "golang-nuts" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/golang-nuts/eqEzMk5QFuk/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> golan...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/2eb95d66-b5e5-4640-a6cc-529189fe38ed%40googlegroups.com >> >> <https://groups.google.com/d/msgid/golang-nuts/2eb95d66-b5e5-4640-a6cc-529189fe38ed%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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/c7efda8b-eba7-4906-96b5-0eca6790bb5c%40googlegroups.com.