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

x/tools/cmd/gorename: creates a `pkg/mod` inside `$GOPATH` #34222

Open
joeblubaugh opened this issue Sep 10, 2019 · 6 comments
Open

x/tools/cmd/gorename: creates a `pkg/mod` inside `$GOPATH` #34222

joeblubaugh opened this issue Sep 10, 2019 · 6 comments

Comments

@joeblubaugh
Copy link

@joeblubaugh joeblubaugh commented Sep 10, 2019

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

$ go version
go version go1.13 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
❯ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/joe/Library/Caches/go-build"
GOENV="/Users/joe/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/joe/workspace/lightstep/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.13/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.13/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
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/jj/1hp68zpx4jjbx39qsb2d_z0r0000gq/T/go-build288840603=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

From inside the $GOPATH run `$ gorename -from "github.com/lighstep.$PACAKGE"::symbol --to symbol2

What did you expect to see?

The symbol to be renamed without error.

What did you see instead?

A very long list of errors involving searching for modules that are already in vendor/ as well as a large number of packages installed to $GOPATH/pkg/mod even though there is no go.mod in this codebase.

Errors:

/Users/joe/workspace/lightstep/go/pkg/mod/github.com/golang/protobuf@v1.2.0/ptypes/any.go:42:2: could not import github.com/golang/protobuf/proto (cannot find package "github.com/golang/protobuf/proto" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/github.com/golang/protobuf/proto (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/github.com/golang/protobuf/proto (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/github.com/golang/protobuf@v1.2.0/ptypes/any.go:43:2: could not import github.com/golang/protobuf/ptypes/any (cannot find package "github.com/golang/protobuf/ptypes/any" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/github.com/golang/protobuf/ptypes/any (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/github.com/golang/protobuf/ptypes/any (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/github.com/golang/protobuf@v1.2.0/ptypes/duration.go:42:8: could not import github.com/golang/protobuf/ptypes/duration (cannot find package "github.com/golang/protobuf/ptypes/duration" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/github.com/golang/protobuf/ptypes/duration (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/github.com/golang/protobuf/ptypes/duration (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/github.com/golang/protobuf@v1.2.0/ptypes/timestamp.go:41:7: could not import github.com/golang/protobuf/ptypes/timestamp (cannot find package "github.com/golang/protobuf/ptypes/timestamp" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/github.com/golang/protobuf/ptypes/timestamp (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/github.com/golang/protobuf/ptypes/timestamp (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/genproto@v0.0.0-20180817151627-c66870c02cf8/googleapis/rpc/status/status.pb.go:6:14: could not import github.com/golang/protobuf/proto (cannot find package "github.com/golang/protobuf/proto" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/github.com/golang/protobuf/proto (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/github.com/golang/protobuf/proto (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/genproto@v0.0.0-20180817151627-c66870c02cf8/googleapis/rpc/status/status.pb.go:9:12: could not import github.com/golang/protobuf/ptypes/any (cannot find package "github.com/golang/protobuf/ptypes/any" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/github.com/golang/protobuf/ptypes/any (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/github.com/golang/protobuf/ptypes/any (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/net@v0.0.0-20190311183353-d8887717615a/trace/histogram.go:17:2: could not import golang.org/x/net/internal/timeseries (go/build: importGo golang.org/x/net/internal/timeseries: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/net@v0.0.0-20190311183353-d8887717615a/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/src/github.com/lightstep/vendor/google.golang.org/api/transport/http/internal/propagation/http.go:38:32: cannot use (*HTTPFormat)(nil) (value of type *HTTPFormat) as propagation.HTTPFormat value in variable declaration: wrong type for method SpanContextFromRequest
/Users/joe/workspace/lightstep/go/pkg/mod/github.com/golang/protobuf@v1.2.0/ptypes/duration/duration.pb.go:6:14: could not import github.com/golang/protobuf/proto (cannot find package "github.com/golang/protobuf/proto" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/github.com/golang/protobuf/proto (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/github.com/golang/protobuf/proto (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/github.com/golang/protobuf@v1.2.0/ptypes/timestamp/timestamp.pb.go:6:14: could not import github.com/golang/protobuf/proto (cannot find package "github.com/golang/protobuf/proto" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/github.com/golang/protobuf/proto (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/github.com/golang/protobuf/proto (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/balancer.go:26:2: could not import google.golang.org/grpc/codes (go/build: importGo google.golang.org/grpc/codes: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/balancer.go:27:2: could not import google.golang.org/grpc/credentials (go/build: importGo google.golang.org/grpc/credentials: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/balancer.go:28:2: could not import google.golang.org/grpc/grpclog (go/build: importGo google.golang.org/grpc/grpclog: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/balancer.go:29:2: could not import google.golang.org/grpc/naming (go/build: importGo google.golang.org/grpc/naming: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/balancer.go:30:2: could not import google.golang.org/grpc/status (go/build: importGo google.golang.org/grpc/status: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/balancer_conn_wrappers.go:25:2: could not import google.golang.org/grpc/balancer (go/build: importGo google.golang.org/grpc/balancer: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/balancer_conn_wrappers.go:26:2: could not import google.golang.org/grpc/connectivity (go/build: importGo google.golang.org/grpc/connectivity: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/balancer_conn_wrappers.go:28:2: could not import google.golang.org/grpc/resolver (go/build: importGo google.golang.org/grpc/resolver: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/clientconn.go:34:4: could not import google.golang.org/grpc/balancer/roundrobin (go/build: importGo google.golang.org/grpc/balancer/roundrobin: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/clientconn.go:39:2: could not import google.golang.org/grpc/internal/backoff (go/build: importGo google.golang.org/grpc/internal/backoff: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/clientconn.go:40:2: could not import google.golang.org/grpc/internal/channelz (go/build: importGo google.golang.org/grpc/internal/channelz: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/clientconn.go:41:2: could not import google.golang.org/grpc/internal/envconfig (go/build: importGo google.golang.org/grpc/internal/envconfig: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/clientconn.go:42:2: could not import google.golang.org/grpc/internal/grpcsync (go/build: importGo google.golang.org/grpc/internal/grpcsync: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/clientconn.go:43:2: could not import google.golang.org/grpc/internal/transport (go/build: importGo google.golang.org/grpc/internal/transport: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/clientconn.go:44:2: could not import google.golang.org/grpc/keepalive (go/build: importGo google.golang.org/grpc/keepalive: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/clientconn.go:45:2: could not import google.golang.org/grpc/metadata (go/build: importGo google.golang.org/grpc/metadata: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/clientconn.go:47:4: could not import google.golang.org/grpc/resolver/dns (go/build: importGo google.golang.org/grpc/resolver/dns: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/clientconn.go:48:4: could not import google.golang.org/grpc/resolver/passthrough (go/build: importGo google.golang.org/grpc/resolver/passthrough: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/codec.go:22:2: could not import google.golang.org/grpc/encoding (go/build: importGo google.golang.org/grpc/encoding: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/codec.go:23:4: could not import google.golang.org/grpc/encoding/proto (go/build: importGo google.golang.org/grpc/encoding/proto: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/dialoptions.go:30:2: could not import google.golang.org/grpc/internal (go/build: importGo google.golang.org/grpc/internal: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/dialoptions.go:36:2: could not import google.golang.org/grpc/stats (go/build: importGo google.golang.org/grpc/stats: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/rpc_util.go:41:2: could not import google.golang.org/grpc/peer (go/build: importGo google.golang.org/grpc/peer: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/server.go:36:2: could not import golang.org/x/net/trace (go/build: importGo golang.org/x/net/trace: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/server.go:43:2: could not import google.golang.org/grpc/internal/binarylog (go/build: importGo google.golang.org/grpc/internal/binarylog: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/server.go:51:2: could not import google.golang.org/grpc/tap (go/build: importGo google.golang.org/grpc/tap: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/stream.go:38:2: could not import google.golang.org/grpc/internal/grpcrand (go/build: importGo google.golang.org/grpc/internal/grpcrand: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/google.golang.org/grpc@v1.19.0/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/net@v0.0.0-20190311183353-d8887717615a/http2/frame.go:17:2: could not import golang.org/x/net/http/httpguts (go/build: importGo golang.org/x/net/http/httpguts: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/net@v0.0.0-20190311183353-d8887717615a/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/net@v0.0.0-20190311183353-d8887717615a/http2/frame.go:18:2: could not import golang.org/x/net/http2/hpack (go/build: importGo golang.org/x/net/http2/hpack: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/net@v0.0.0-20190311183353-d8887717615a/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/net@v0.0.0-20190311183353-d8887717615a/http2/transport.go:35:2: could not import golang.org/x/net/idna (go/build: importGo golang.org/x/net/idna: exit status 1
error writing go.mod: open /Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/net@v0.0.0-20190311183353-d8887717615a/go.mod298498081.tmp: permission denied

)
/Users/joe/workspace/lightstep/go/src/github.com/lightstep/vendor/cloud.google.com/go/iam/iam.go:49:21: cannot use ([]codes.Code literal) (value of type []codes.Code) as []codes.Code value in argument to gax.OnCodes
/Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/oauth2@v0.0.0-20180821212333-d2e6202438be/oauth2.go:19:2: could not import golang.org/x/net/context (cannot find package "golang.org/x/net/context" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/golang.org/x/net/context (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/golang.org/x/net/context (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/oauth2@v0.0.0-20180821212333-d2e6202438be/oauth2.go:20:2: could not import golang.org/x/oauth2/internal (cannot find package "golang.org/x/oauth2/internal" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/golang.org/x/oauth2/internal (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/golang.org/x/oauth2/internal (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/oauth2@v0.0.0-20180821212333-d2e6202438be/jwt/jwt.go:21:2: could not import golang.org/x/net/context (cannot find package "golang.org/x/net/context" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/golang.org/x/net/context (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/golang.org/x/net/context (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/oauth2@v0.0.0-20180821212333-d2e6202438be/jwt/jwt.go:22:2: could not import golang.org/x/oauth2 (cannot find package "golang.org/x/oauth2" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/golang.org/x/oauth2 (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/golang.org/x/oauth2 (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/oauth2@v0.0.0-20180821212333-d2e6202438be/jwt/jwt.go:23:2: could not import golang.org/x/oauth2/internal (cannot find package "golang.org/x/oauth2/internal" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/golang.org/x/oauth2/internal (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/golang.org/x/oauth2/internal (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/oauth2@v0.0.0-20180821212333-d2e6202438be/jwt/jwt.go:24:2: could not import golang.org/x/oauth2/jws (cannot find package "golang.org/x/oauth2/jws" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/golang.org/x/oauth2/jws (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/golang.org/x/oauth2/jws (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/oauth2@v0.0.0-20180821212333-d2e6202438be/google/appengine.go:13:2: could not import golang.org/x/net/context (cannot find package "golang.org/x/net/context" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/golang.org/x/net/context (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/golang.org/x/net/context (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/oauth2@v0.0.0-20180821212333-d2e6202438be/google/appengine.go:14:2: could not import golang.org/x/oauth2 (cannot find package "golang.org/x/oauth2" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/golang.org/x/oauth2 (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/golang.org/x/oauth2 (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/oauth2@v0.0.0-20180821212333-d2e6202438be/google/default.go:16:2: could not import cloud.google.com/go/compute/metadata (cannot find package "cloud.google.com/go/compute/metadata" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/cloud.google.com/go/compute/metadata (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/cloud.google.com/go/compute/metadata (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/oauth2@v0.0.0-20180821212333-d2e6202438be/google/google.go:17:2: could not import golang.org/x/oauth2/jwt (cannot find package "golang.org/x/oauth2/jwt" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/golang.org/x/oauth2/jwt (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/golang.org/x/oauth2/jwt (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/oauth2@v0.0.0-20180821212333-d2e6202438be/google/jwt.go:13:2: could not import golang.org/x/oauth2/internal (cannot find package "golang.org/x/oauth2/internal" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/golang.org/x/oauth2/internal (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/golang.org/x/oauth2/internal (from $GOPATH))
/Users/joe/workspace/lightstep/go/pkg/mod/golang.org/x/oauth2@v0.0.0-20180821212333-d2e6202438be/google/jwt.go:14:2: could not import golang.org/x/oauth2/jws (cannot find package "golang.org/x/oauth2/jws" in any of:
	/usr/local/Cellar/go/1.13/libexec/src/golang.org/x/oauth2/jws (from $GOROOT)
	/Users/joe/workspace/lightstep/go/src/golang.org/x/oauth2/jws (from $GOPATH))

Before running gorename, there was no pkg/mod directory.

@gopherbot gopherbot added this to the Unreleased milestone Sep 10, 2019
@onokonem
Copy link

@onokonem onokonem commented Sep 11, 2019

same story

@gopherbot gopherbot added the Tools label Sep 12, 2019
@toothrot toothrot changed the title x/tools/cmd/gorename creates a `pkg/mod` inside `$GOPATH` x/tools/cmd/gorename: creates a `pkg/mod` inside `$GOPATH` Sep 16, 2019
@toothrot
Copy link
Contributor

@toothrot toothrot commented Sep 16, 2019

I believe that gorename might have some issues in module mode: #27571, #24661. You may have better luck by setting GO111MODULE=off for gorename, or if possible, using gopls in your editor.

/cc @stamblerre @ianthehat who may have more context

@scottjbarr
Copy link

@scottjbarr scottjbarr commented Oct 17, 2019

@toothrot Good tip. Setting GO111MODULE=off in the environment variables stops this issue for me with gorename.

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Oct 17, 2019

gorename is not supported for use with modules, and I don't believe it's being actively maintained, so it's possible that it has had some regressions in GOPATH mode with the latest versions of Go. We would certainly accept any contributions to improve support for gorename in GOPATH mode. For modules, gopls does package-local renames (with module-local renames coming soon), and the gopls rename command is available on the command line.

@scottjbarr
Copy link

@scottjbarr scottjbarr commented Oct 18, 2019

Thanks for the tip @stamblerre

@hyangah
Copy link
Contributor

@hyangah hyangah commented Feb 21, 2020

As discussed in the vscode-go issue linked above, it seems like gorename is broken with newer versions of go. If my GOPATH has packages with go.mod and attempt to rename exported names, I encounter the same issue. Maybe we need to suggest gopls rename as an offical alternative even for GOPATH mode or GO111MODULE=auto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants
You can’t perform that action at this time.