Skip to content
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

cmd/go: go list fails when run in $GOPATH/pkg/mod #30238

Closed
pmer opened this issue Feb 14, 2019 · 3 comments
Closed

cmd/go: go list fails when run in $GOPATH/pkg/mod #30238

pmer opened this issue Feb 14, 2019 · 3 comments

Comments

@pmer
Copy link

pmer commented Feb 14, 2019

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

$ go version
go version go1.11.5 darwin/amd64
$ go version
go version go1.12rc1 darwin/amd64

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/pdm/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/pdm/example"
GOPROXY=""
GORACE=""
GOROOT="/Users/pdm/SourceRef/go-go1.12rc1"
GOTMPDIR=""
GOTOOLDIR="/Users/pdm/SourceRef/go-go1.12rc1/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/pdm/example/pkg/mod/github.com/gocql/gocql@v0.0.0-20190208221138-c53c3654dc8a/go.mod"
CGO_CFLAGS="-I/usr/local/include"
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/ml/qr7r1km5315bsm79wn1q60c00000gn/T/go-build465168117=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Tried to go list a module in $GOPATH/pkg/mod.

mkdir example && cd example
export GOPATH="$PWD"
mkdir main && cd main
cat > main.go <<EOF
package main

import "github.com/gocql/gocql"

func main() {
    gocql.NewCluster("192.168.1.1", "192.168.1.2", "192.168.1.3")
}
EOF
cat > go.mod <<EOF
module main

require github.com/gocql/gocql v0.0.0-20190208221138-c53c3654dc8a
EOF
go mod download
cd "$GOPATH/pkg/mod/github.com/gocql/gocql@v0.0.0-20190208221138-c53c3654dc8a" && go list

What did you expect to see?

$ go list
github.com/gocql/gocql

What did you see instead?

In go1.11.5:

$ cd "$GOPATH/pkg/mod/github.com/gocql/gocql@v0.0.0-20190208221138-c53c3654dc8a" && go list
go: writing go.sum: open $GOPATH/pkg/mod/github.com/gocql/gocql@v0.0.0-20190208221138-c53c3654dc8a/go.sum: permission denied

In go1.12rc1:

$ cd "$GOPATH/pkg/mod/github.com/gocql/gocql@v0.0.0-20190208221138-c53c3654dc8a" && go list
go: writing go.sum: open $GOPATH/pkg/mod/github.com/gocql/gocql@v0.0.0-20190208221138-c53c3654dc8a/go.sum389063318.tmp: permission denied

Related

#27161

@bcmills
Copy link
Contributor

bcmills commented Feb 14, 2019

Dup of #30185.

@bcmills bcmills closed this as completed Feb 14, 2019
@jiacai2050
Copy link

jiacai2050 commented Nov 10, 2019

Sorry to comment.

#30185 redirect to #34054, but it seems this is by design?

gopls rely on go list, so if it's by design, how can we use gopl for project in $GOPATH/pkg/mod?

LSP :: Connected to [gopls:94397 status:starting].
LSP :: go [list -f {{context.GOARCH}} {{context.Compiler}} -- unsafe]: exit status 1: error writing go.mod: open $GOPATH/pkg/mod/github.com/cep21/circuit/v3@v3.1.0/go.mod298498081.tmp: permission denied

I file an issue to track.

@ianthehat
Copy link

commented in #35485

@golang golang locked and limited conversation to collaborators Nov 9, 2020
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

5 participants