Skip to content

Problems using go get with Go Modules activated #27439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
carlca opened this issue Sep 1, 2018 · 3 comments
Closed

Problems using go get with Go Modules activated #27439

carlca opened this issue Sep 1, 2018 · 3 comments

Comments

@carlca
Copy link

carlca commented Sep 1, 2018

What version of Go are you using (go version)?

go version go1.11 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN="/Users/carlca/Code/go/bin"
GOCACHE="/Users/carlca/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/carlca/Code/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/1d/1rqcnlq51zd4j_vqhp1kv3540000gp/T/go-build524150273=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

  1. Navigate to ~
  2. Run go get github.com/<supplier>/<repo>

What did you expect to see?

I expected no error message, just a carriage return, and I expected then to find that the repo had been installed in the specified folder.

What did you see instead?

go: cannot find main module; see 'go help modules'

I gather and hope that the behaviour os go get will change in go 1.12 but, as I have been asking for two weeks now, what are we supposed to do until then?

At the moment I have to do a git clone followed by a go mod int <supplier>/<repo> yet @rsc says that "Module-based go get works for me" https://twitter.com/_rsc/status/1034625354172981248 - but has also said that there is an issue and it has to be sorted for go 1.12 #24250.

I know I'm not the only one with these questions, but unless I'm missing some very loud and clear messages, it does seem that the communication over these issues has been somewhat lacking.

@agnivade
Copy link
Contributor

agnivade commented Sep 2, 2018

Like you have correctly found above - this issue is a duplicate of #24250. See also this #27380 for a similar issue.

@carlca
Copy link
Author

carlca commented Sep 2, 2018

I have come up with what is a partial solution. It is a shell script which simulates the go get action. The idea is that one copies the git clone url from github.com and then runs gog.sh [⌘]v. Of course, with Github.com you can copy the git clone url with just a couple of keystrokes. One can then run go run, go build or go install as usual.

The contents of gog.sh can be found at https://gist.github.com/carlca/e97eccd545f2465f1e2a0c42356e6ffd.

I use an alias to save me even more keystrokes, alias gog='gog.sh'!

@bcmills
Copy link
Contributor

bcmills commented Sep 2, 2018

Duplicate of #24250.

@bcmills bcmills closed this as completed Sep 2, 2018
@golang golang locked and limited conversation to collaborators Sep 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants