Skip to content

Get error when I use go get command with private package #68072

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
wuye251 opened this issue Jun 19, 2024 · 2 comments
Closed

Get error when I use go get command with private package #68072

wuye251 opened this issue Jun 19, 2024 · 2 comments

Comments

@wuye251
Copy link

wuye251 commented Jun 19, 2024

Go version

go version go1.22.2 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/root/go/pkg/mod'
GONOPROXY='code.xxx.com'
GONOSUMDB='code.xxx.com'
GOOS='linux'
GOPATH='/root/go'
GOPRIVATE='code.xxx.com'
GOPROXY='https://goproxy.cn,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.2'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/root/code/param_config_service/go.mod'
GOWORK='/root/code/go.work'
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 -fdebug-prefix-map=/tmp/go-build420680952=/tmp/go-build -gno-record-gcc-switches'

What did you do?

I done below steps before go get private package:
Step1: set go_private_proxy use code.xxx.com.
Step2: set git insteadOf---

[url "[email protected]:"]
        insteadOf = https://code.xxx.com/

My private repo on gitea like:
image

After I done these steps. I'm use go get at another repo import utils repo into my project.
I use go get -u code.xxx.com/common/ts_utils command import utils private package into my other repo. But I get err:
image

Also I'm try to use go get -v code.teamsun.com/common/ts_utils.git(extra suffix: .git)
image

I think i need to add utils project go.mod:
image

What did you see happen?

I am not sure why such an error occurs with go get to my private package.
image
image

What did you expect to see?

I tried something else:

  1. remove utils go.mod. go get -u xxx/xxx/utils.git(But I need go.mod file)
  2. use replace in import repo go.mod file:
image

But I need manual to upgrade private pkg when utils code update .

These are some intermediate steps that can be ignored because I don't want the real problem to get lost.

Thank you all in advance for your help.

@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

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

3 participants