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: proxy URL's not working with go modules #29484

Open
mattouille opened this Issue Dec 31, 2018 · 8 comments

Comments

Projects
None yet
5 participants
@mattouille
Copy link

mattouille commented Dec 31, 2018

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

$ go version
go version go1.11.1 darwin/amd64

Does this issue reproduce with the latest release?

Unknown

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/matt/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/matt/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="/Users/matt/Capstone/swma2/go.mod"
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/j8/vl972_rx1x15z_pf6f0ff0540000gn/T/go-build530235713=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

go get cloud.google.com/go/pubsub

What did you expect to see?

Changes in go.mod and go.sum

What did you see instead?

go: finding cloud.google.com/go/pubsub latest
build gitlab.com/my/package: cannot find module for path cloud.google.com/go/pubsub

Additional Information

It looks like cloud.google.com/go is a proxy or vanity URL for code.googlesource.com/gocloud. Additionally, I found a note that the repo at googlesource.com has a GitHub mirror here. I can only pull the pubsub package (or any package rather) if I use the GitHub mirror. Anything else results in:

$: go get -u cloud.google.com/go/pubsub@v0.34.0
go: finding cloud.google.com/go/pubsub v0.34.0
go get cloud.google.com/go/pubsub@v0.34.0: unknown revision pubsub/v0.34.0
$: go get -u cloud.google.com/go/pubsub
go: finding cloud.google.com/go/pubsub latest
go get cloud.google.com/go/pubsub: no matching versions for query "latest"

I wanted to add this to the experience report, but I'd like to determine the actual cause before I do. The subject I used is my best guess as to what happened given what I know about how Go modules pull from various sources.

@katiehockman

This comment has been minimized.

Copy link
Contributor

katiehockman commented Jan 2, 2019

@mattouille the link to the Github mirror gives a 404. Did you mean to link to https://github.com/googleapis/google-cloud-go instead? I also updated the title to match the Go issue format guidelines. Are there any other specific details you can add to the title of the issue? As it is now, it sounds like all proxy urls fail with modules, though that's not clear to me from the issue description.

/cc @bcmills

@katiehockman katiehockman changed the title Proxy URL's not working with go modules cmd/go: proxy URL's not working with go modules Jan 2, 2019

@mattouille

This comment has been minimized.

Copy link

mattouille commented Jan 3, 2019

@katiehockman my apologies for not following the format guidelines, this is my first issue here and I should've read the contributing guide.

That is the URL I meant, I forgot to tack on "https://" after pasting the import URL.

I'm really not sure of anyone else using proxy URL's; and to be fair I'm not sure that's what Google is doing either, it's just how I guessed they're doing it. If you want me to dig into it further I can.

I'm not sure of what other details to add other than what I've included but I'm happy to provide any clarification and I can probably also be available to reproduce it as well.

@katiehockman

This comment has been minimized.

Copy link
Contributor

katiehockman commented Jan 3, 2019

No problem! Thanks for reporting.

@hyangah

This comment has been minimized.

Copy link
Contributor

hyangah commented Jan 4, 2019

@mattouille Can you please try go get -v -u cloud.google.com/go/pubsub and share the output?
The -v option will print some more details. I couldn't reproduce and the output is like this:

$ go get -u -v cloud.google.com/go/pubsub
Fetching https://cloud.google.com/go/pubsub?go-get=1
Parsing meta tags from https://cloud.google.com/go/pubsub?go-get=1 (status code 200)
get "cloud.google.com/go/pubsub": found meta tag get.metaImport{Prefix:"cloud.google.com/go", VCS:"git", RepoRoot:"https://code.googlesource.com/gocloud"} at https://cloud.google.com/go/pubsub?go-get=1
get "cloud.google.com/go/pubsub": verifying non-authoritative meta tag
Fetching https://cloud.google.com/go?go-get=1
Parsing meta tags from https://cloud.google.com/go?go-get=1 (status code 200)
go: finding cloud.google.com/go/pubsub latest
Fetching https://cloud.google.com/go?go-get=1
Parsing meta tags from https://cloud.google.com/go?go-get=1 (status code 200)
get "cloud.google.com/go": found meta tag get.metaImport{Prefix:"cloud.google.com/go", VCS:"git", RepoRoot:"https://code.googlesource.com/gocloud"} at https://cloud.google.com/go?go-get=1
...
@mattouille

This comment has been minimized.

Copy link

mattouille commented Jan 5, 2019

go get -u -v cloud.google.com/go/pubsub
Fetching https://cloud.google.com/go/pubsub?go-get=1
Parsing meta tags from https://cloud.google.com/go/pubsub?go-get=1 (status code 200)
get "cloud.google.com/go/pubsub": found meta tag get.metaImport{Prefix:"cloud.google.com/go", VCS:"git", RepoRoot:"https://code.googlesource.com/gocloud"} at https://cloud.google.com/go/pubsub?go-get=1
get "cloud.google.com/go/pubsub": verifying non-authoritative meta tag
Fetching https://cloud.google.com/go?go-get=1
Parsing meta tags from https://cloud.google.com/go?go-get=1 (status code 200)
go: finding cloud.google.com/go/pubsub latest
Fetching https://cloud.google.com/go?go-get=1
Parsing meta tags from https://cloud.google.com/go?go-get=1 (status code 200)
get "cloud.google.com/go": found meta tag get.metaImport{Prefix:"cloud.google.com/go", VCS:"git", RepoRoot:"https://code.googlesource.com/gocloud"} at https://cloud.google.com/go?go-get=1
Fetching https://cloud.google.com?go-get=1
Parsing meta tags from https://cloud.google.com?go-get=1 (status code 200)
go get cloud.google.com/go/pubsub: no matching versions for query "latest"

Typically it would say this, then if you looked in go.mod and go.sum no additions would be present.

@hyangah

This comment has been minimized.

Copy link
Contributor

hyangah commented Jan 7, 2019

Strange. Maybe git commands failed? @mattouille If you provide -x option, does the go command offer more info?

> go mod tidy
> go clean --modcache
> go get -v -x cloud.google.com/go/pubsub
@bcmills

This comment has been minimized.

Copy link
Member

bcmills commented Jan 7, 2019

I'm unable to reproduce this issue using go1.11.4 in module mode starting from an empty module.

Are you sure you don't have an errant replace directive in your go.mod file?

$ go mod init golang.org/issue/scratch
go: creating new go.mod: module golang.org/issue/scratch

$ go1.11.4 get cloud.google.com/go/pubsub
go: finding cloud.google.com/go/pubsub latest
go: finding cloud.google.com/go v0.34.0
go: downloading cloud.google.com/go v0.34.0
go: finding github.com/golang/protobuf/proto latest
go: finding go.opencensus.io/tag latest
go: finding go.opencensus.io/plugin/ocgrpc latest
go: finding google.golang.org/grpc/keepalive latest
go: finding google.golang.org/grpc v1.17.0
go: finding google.golang.org/grpc/status latest
go: finding google.golang.org/grpc/codes latest
go: finding google.golang.org/genproto/googleapis/iam latest
go: finding github.com/googleapis/gax-go v2.0.2+incompatible
go: downloading github.com/googleapis/gax-go v2.0.2+incompatible
go: finding github.com/golang/protobuf/ptypes/duration latest
go: finding github.com/golang/protobuf v1.2.0
go: finding github.com/golang/protobuf/ptypes latest
go: finding golang.org/x/sync/semaphore latest
go: finding go.opencensus.io v0.18.0
go: finding go.opencensus.io/plugin latest
go: downloading google.golang.org/grpc v1.17.0
go: downloading go.opencensus.io v0.18.0
go: downloading github.com/golang/protobuf v1.2.0
go: finding go.opencensus.io/stats/view latest
go: finding go.opencensus.io/stats latest
go: finding golang.org/x/sync latest
go: downloading golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4
go: finding google.golang.org/genproto/protobuf/field_mask latest
go: finding google.golang.org/grpc/metadata latest
go: finding google.golang.org/api/transport latest
go: finding google.golang.org/api/iterator latest
go: finding google.golang.org/api/option latest
go: finding golang.org/x/sync/errgroup latest
go: finding google.golang.org/api/support/bundler latest
go: finding google.golang.org/genproto/googleapis/pubsub latest
go: finding google.golang.org/genproto/googleapis latest
go: finding google.golang.org/genproto/protobuf latest
go: finding google.golang.org/genproto latest
go: downloading google.golang.org/genproto v0.0.0-20181221175505-bd9b4fb69e2f
go: finding google.golang.org/api v0.1.0
go: finding google.golang.org/api/support latest
go: downloading google.golang.org/api v0.1.0
go: finding google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898
go: finding cloud.google.com/go v0.26.0
go: finding github.com/google/go-cmp v0.2.0
go: finding github.com/prometheus/client_golang v0.8.0
go: finding golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890
go: finding golang.org/x/net v0.0.0-20181106065722-10aee1819953
go: finding golang.org/x/sys v0.0.0-20180830151530-49385e6e1522
go: finding golang.org/x/text v0.3.0
go: finding google.golang.org/appengine v1.3.0
go: finding honnef.co/go/tools v0.0.0-20180728063816-88497007e858
go: finding github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e
go: finding github.com/kisielk/gotool v1.0.0
go: finding github.com/grpc-ecosystem/grpc-gateway v1.5.0
go: finding golang.org/x/sync v0.0.0-20181108010431-42b317875d0f
go: finding github.com/client9/misspell v0.3.4
go: finding golang.org/x/net v0.0.0-20180724234803-3673e40ba225
go: finding github.com/ghodss/yaml v1.0.0
go: finding github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273
go: finding google.golang.org/grpc v1.14.0
go: finding github.com/golang/mock v1.1.1
go: finding google.golang.org/grpc v1.16.0
go: finding golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e
go: finding google.golang.org/genproto v0.0.0-20180831171423-11092d34479b
go: finding golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3
go: finding github.com/openzipkin/zipkin-go v0.1.1
go: finding github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
go: finding golang.org/x/net v0.0.0-20180906233101-161cd47e91fd
go: finding golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
go: finding golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52
go: finding golang.org/x/net v0.0.0-20180826012351-8a410e7b638d
go: finding git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999
go: finding google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
go: finding golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
go: finding google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf
go: finding github.com/matttproud/golang_protobuf_extensions v1.0.1
go: finding github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
go: finding github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
go: finding github.com/golang/lint v0.0.0-20180702182130-06c8688daad7
go: finding google.golang.org/appengine v1.1.0
go: finding golang.org/x/lint v0.0.0-20180702182130-06c8688daad7
go: finding gopkg.in/yaml.v2 v2.2.1
go: finding gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
go: downloading golang.org/x/net v0.0.0-20181106065722-10aee1819953
go: downloading golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890
go: downloading golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e
go: downloading golang.org/x/text v0.3.0

$ go1.11.4 get -u cloud.google.com/go/pubsub@v0.34.0
go: finding cloud.google.com/go/pubsub v0.34.0

$
@mattouille

This comment has been minimized.

Copy link

mattouille commented Jan 8, 2019

100% and I checked the go.mod history as well. I will note this did work on my Linux machine in the same repository. I'll try it out on my MBP where I originally reported it from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment