Skip to content

go mod download 404 Not Found for private module #69381

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
GRbit opened this issue Sep 10, 2024 · 4 comments
Closed

go mod download 404 Not Found for private module #69381

GRbit opened this issue Sep 10, 2024 · 4 comments

Comments

@GRbit
Copy link

GRbit commented Sep 10, 2024

Go version

1.23.1

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/grbit/.cache/go-build'
GOENV='/home/grbit/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/grbit/ssd/go/pkg/mod'
GONOPROXY='gitlab.com/nextpax,bitbucket.org/nextpaxcom'
GONOSUMDB='gitlab.com/nextpax,bitbucket.org/nextpaxcom'
GOOS='linux'
GOPATH='/home/grbit/ssd/go'
GOPRIVATE='gitlab.com/nextpax,bitbucket.org/nextpaxcom'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/grbit/.local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/grbit/.local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.1'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/grbit/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3978658459=/tmp/go-build -gno-record-gcc-switches'

What did you do?

go mod download -x gitlab.com/nextpax/nextpax-commons/v2@latest

What did you see happen?

go mod download -x  gitlab.com/nextpax/nextpax-commons/v2@latest
# get https://gitlab.com/nextpax/nextpax-commons/v2?go-get=1
# get https://gitlab.com/nextpax/nextpax-commons/v2?go-get=1: 404 Not Found (0.264s)
# get https://gitlab.com/nextpax/nextpax-commons/v2?go-get=1
# get https://gitlab.com/nextpax/nextpax-commons/v2?go-get=1: 404 Not Found (0.255s)
go: gitlab.com/nextpax/nextpax-commons/v2@latest: unrecognized import path "gitlab.com/nextpax/nextpax-commons/v2": reading https://gitlab.com/nextpax/nextpax-commons/v2?go-get=1: 404 Not Found

What did you expect to see?

I expect that module will be correctly downloaded. Something like

[0] $ go mod download -x  gitlab.com/nextpax/nextpax-commons/v2@latest
# get https://gitlab.com/nextpax/nextpax-commons/v2?go-get=1
# get https://gitlab.com/nextpax/nextpax-commons/v2?go-get=1: 200 OK (0.253s)
# get https://gitlab.com/nextpax/nextpax-commons?go-get=1
# get https://gitlab.com/nextpax/nextpax-commons?go-get=1: 200 OK (0.186s)

From the same command line curl get 200 OK for this URL

$ curl -o /dev/null -s -w "%{http_code}\n"  https://gitlab.com/nextpax/nextpax-commons/v2?go-get=1
200
$ curl https://gitlab.com/nextpax/nextpax-commons/v2?go-get=1
<html><head><meta name="go-import" content="gitlab.com/nextpax/nextpax-commons git https://gitlab.com/nextpax/nextpax-commons.git"></head><body>go get gitlab.com/nextpax/nextpax-commons</body></html>

I want to debug what exactly go get does on my local machine, because I can not reproduce this behavior on any other machine. But the only option I have is -x option. I also have strace, but it doesn't give much info. The IP addresses are the same, but what go mod writes/reads to gitlab is different. Since it's https it's hard to dive inside to see the real difference.

If you could give my any clues on how to debug it, that would be nice.

@seankhliao
Copy link
Member

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Sep 10, 2024
@GRbit
Copy link
Author

GRbit commented Sep 11, 2024

Turned out it's a gitlab bug with access levels using tokens from .netrc, so techincally, the issue could be closed.

However, I see it as a big problem that you cannot debug go mod or go get behavior.
If anyone could suggest any ways to debug go mod that would be AMAZING, because I've spent hours trying to find a problem with no result. It refuses to use http_proxy env variable, it has nothing like curl SSLKEYLOGFILE functionality to read it's requests with wireshark. It's a total pain to debug it.

The final solution that helped me was strace that showed all the files read by go mod. That's how I found .netrc file with credentials and detected this gitlab access problem.

I wanted just a simple thing: add more verbosity to the way request is built by go, but I'm afraid there is no way to do it, and that's a problem.

@ianlancetaylor
Copy link
Contributor

@GRbit These are good issues to bring up in a forum, rather than the issue tracker. See https://go.dev/wiki/Questions. Thanks.

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

No branches or pull requests

4 participants