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

go mod: git setting "instead of" not work in go mod #34513

Closed
anotherGoogleFan opened this issue Sep 25, 2019 · 1 comment
Closed

go mod: git setting "instead of" not work in go mod #34513

anotherGoogleFan opened this issue Sep 25, 2019 · 1 comment

Comments

@anotherGoogleFan
Copy link

anotherGoogleFan commented Sep 25, 2019

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

$ go version
go version go1.13 windows/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
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\xxx\AppData\Local\go-build
set GOENV=C:\Users\xxx\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=E:\GoProjects
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\xxx\AppData\Local\Temp\go-build269664658=/tmp/go-build -gno-record-gcc-switches

What did you do?

I set in git like

git config --global url."git@git.example.net:".insteadOf "https://git.example.net/"

and it works fine.
But when I cd a project folder such as git.exmaple.net/yyy with a go.mod file, and run

go get git.example.net/xxx

I see something like this:

go get git.example.net/xxx: unrecognized import path "git.example.net/xxx" (https fetch: Get https://git.example.net/xxx: x509: certificate signed by unknown authority)

It seems that the config in git not work here.
And...

go mod tidy -v
git.example.net/yyy imports
        git.example.net/xxx: cannot find module providing package git.example.net/xxx
@anotherGoogleFan anotherGoogleFan changed the title go mod: GOPRIVATE conflict with git setting "instead of" go mod: git setting "instead of" not work in go mod Sep 25, 2019
@bcmills
Copy link
Contributor

bcmills commented Sep 26, 2019

The git configuration only affects operations on the underlying git repo. The error that you're seeing is coming from before that, when the go command is attempting to resolve the repo for the requested package path.

See https://golang.org/cmd/go/#hdr-Remote_import_paths.

@bcmills bcmills closed this as completed Sep 26, 2019
@golang golang locked and limited conversation to collaborators Sep 25, 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

3 participants