Skip to content

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

Closed as not planned
@wuye251

Description

@wuye251

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions