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

cmd/go: 1.18 fails when vendoring and main module replaces itself #51285

Closed
zhsj opened this issue Feb 20, 2022 · 3 comments
Closed

cmd/go: 1.18 fails when vendoring and main module replaces itself #51285

zhsj opened this issue Feb 20, 2022 · 3 comments
Labels
FrozenDueToAge GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@zhsj
Copy link
Contributor

zhsj commented Feb 20, 2022

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

$ go version
go version go1.18rc1 linux/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
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/zhsj/.cache/go-build"
GOENV="/home/zhsj/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/zhsj/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/zhsj/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn"
GOROOT="/usr/lib/go-1.18"
GOSUMDB="sum.golang.google.cn"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.18/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18rc1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/zhsj/go/src/github.com/containerd/containerd/go.mod"
GOWORK=""
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2918392435=/tmp/go-build -gno-record-gcc-switches"

What did you do?

  1. git clone https://github.com/containerd/containerd
  2. run go list in root dir

What did you expect to see?

Like go1.17, it succeeds with:

zhsj@debian:~/go/src/github.com/containerd/containerd$ /usr/lib/go-1.17/bin/go list
github.com/containerd/containerd

What did you see instead?

zhsj@debian:~/go/src/github.com/containerd/containerd$ go list
go: inconsistent vendoring in /home/zhsj/go/src/github.com/containerd/containerd:
        github.com/containerd/containerd: is marked as replaced in vendor/modules.txt, but not replaced in go.mod

        To ignore the vendor directory, use -mod=readonly or -mod=mod.
        To sync the vendor directory, run:
                go mod vendor
@seankhliao seankhliao changed the title cmd/go: fail to run go list on containerd repo cmd/go: 1.18 fails when vendoring and main module replaces itself Feb 20, 2022
@seankhliao seankhliao added GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Feb 20, 2022
@seankhliao
Copy link
Member

related #34417

simpler reproducer:

-- go.mod --
module go.seankhliao.com/testrepo-791

go 1.18

replace go.seankhliao.com/testrepo-791 => ./.empty

-- .empty/go.mod
module go.seankhliao.com/testrepo-791

go 1.18

results:

$ go list
no Go files in /home/arccy/tmp/testrepo-791

$ go mod vendor
go: warning: "all" matched no packages

$ go list      
go: inconsistent vendoring in /home/arccy/tmp/testrepo-791:
	go.seankhliao.com/testrepo-791: is marked as replaced in vendor/modules.txt, but not replaced in go.mod

	To ignore the vendor directory, use -mod=readonly or -mod=mod.
	To sync the vendor directory, run:
		go mod vendor

cc @bcmills @matloob

@bcmills
Copy link
Contributor

bcmills commented Feb 22, 2022

Duplicate of #34417

@bcmills bcmills marked this as a duplicate of #34417 Feb 22, 2022
@bcmills bcmills closed this as completed Feb 22, 2022
@bcmills
Copy link
Contributor

bcmills commented Feb 22, 2022

Looking at the specific example of github.com/containerd/containerd, I see (https://github.com/containerd/containerd/blob/main/go.mod#L90-L91):

	// prevent transitional dependencies due to containerd having a circular
	// dependency on itself through plugins. see .empty-mod/go.mod for details

As of Go 1.17, the appropriate way to prune out cyclic dependencies is to update the go directive in the main module and any problematic dependencies to go 1.17 or higher to activate module graph pruning.

For compatibility with older go versions, you could pair that with exclude directives for specific older versions of the main module that you want to prune out.

Cryogenics-CI pushed a commit to cloudfoundry/backup-and-restore-sdk-release that referenced this issue Apr 8, 2022
Cryogenics-CI pushed a commit to cloudfoundry/backup-and-restore-sdk-release that referenced this issue Apr 8, 2022
copybara-service bot pushed a commit to google/gvisor that referenced this issue Oct 13, 2022
These versions are compatible with Go 1.18. There are a lot of OSS bugs
about this issue. Notable discussions:
- golang/go#51285
- containerd/containerd#6586

This was fixed upstream in the main branch in containerd/containerd#6605.
The fix was back-ported to v1.5 and v1.6 in containerd/containerd#6716
and containerd/containerd#6717 respectively.

These backports are available in the following versions:
```shell
/tmp/gopathJJGZf/containerd$ git tag --contains 765df66099eec88d0365eaa1e9a933877a058f0b
v1.6.2
v1.6.3
v1.6.4
v1.6.5
v1.6.6
v1.6.7
v1.6.8
/tmp/gopathJJGZf/containerd$ git tag --contains 86bec213720b54bf9ea2813e2c2a577271af58d3
v1.5.11
v1.5.12
v1.5.13
```

So use the smallest versions out of them.

PiperOrigin-RevId: 480919167
copybara-service bot pushed a commit to google/gvisor that referenced this issue Oct 13, 2022
These versions are compatible with Go 1.18. There are a lot of OSS bugs
about this issue. Notable discussions:
- golang/go#51285
- containerd/containerd#6586

This was fixed upstream in the main branch in containerd/containerd#6605.
The fix was back-ported to v1.5 and v1.6 in containerd/containerd#6716
and containerd/containerd#6717 respectively.

These backports are available in the following versions:
```shell
/tmp/gopathJJGZf/containerd$ git tag --contains 765df66099eec88d0365eaa1e9a933877a058f0b
v1.6.2
v1.6.3
v1.6.4
v1.6.5
v1.6.6
v1.6.7
v1.6.8
/tmp/gopathJJGZf/containerd$ git tag --contains 86bec213720b54bf9ea2813e2c2a577271af58d3
v1.5.11
v1.5.12
v1.5.13
```

So use the smallest versions out of them.

PiperOrigin-RevId: 480919167
copybara-service bot pushed a commit to google/gvisor that referenced this issue Oct 13, 2022
These versions are compatible with Go 1.18. There are a lot of OSS bugs
about this issue. Notable discussions:
- golang/go#51285
- containerd/containerd#6586

This was fixed upstream in the main branch in containerd/containerd#6605.
The fix was back-ported to v1.5 and v1.6 in containerd/containerd#6716
and containerd/containerd#6717 respectively.

These backports are available in the following versions:
```shell
/tmp/gopathJJGZf/containerd$ git tag --contains 765df66099eec88d0365eaa1e9a933877a058f0b
v1.6.2
v1.6.3
v1.6.4
v1.6.5
v1.6.6
v1.6.7
v1.6.8
/tmp/gopathJJGZf/containerd$ git tag --contains 86bec213720b54bf9ea2813e2c2a577271af58d3
v1.5.11
v1.5.12
v1.5.13
```

So use the smallest versions out of them.

PiperOrigin-RevId: 480919167
copybara-service bot pushed a commit to google/gvisor that referenced this issue Oct 13, 2022
These versions are compatible with Go 1.18. There are a lot of OSS bugs
about this issue. Notable discussions:
- golang/go#51285
- containerd/containerd#6586

This was fixed upstream in the main branch in containerd/containerd#6605.
The fix was back-ported to v1.5 and v1.6 in containerd/containerd#6716
and containerd/containerd#6717 respectively.

These backports are available in the following versions:
```shell
/tmp/gopathJJGZf/containerd$ git tag --contains 765df66099eec88d0365eaa1e9a933877a058f0b
v1.6.2
v1.6.3
v1.6.4
v1.6.5
v1.6.6
v1.6.7
v1.6.8
/tmp/gopathJJGZf/containerd$ git tag --contains 86bec213720b54bf9ea2813e2c2a577271af58d3
v1.5.11
v1.5.12
v1.5.13
```

So use the smallest versions out of them.

PiperOrigin-RevId: 480919167
copybara-service bot pushed a commit to google/gvisor that referenced this issue Oct 13, 2022
These versions are compatible with Go 1.18. There are a lot of OSS bugs
about this issue. Notable discussions:
- golang/go#51285
- containerd/containerd#6586

This was fixed upstream in the main branch in containerd/containerd#6605.
The fix was back-ported to v1.5 and v1.6 in containerd/containerd#6716
and containerd/containerd#6717 respectively.

These backports are available in the following versions:
```shell
/tmp/gopathJJGZf/containerd$ git tag --contains 765df66099eec88d0365eaa1e9a933877a058f0b
v1.6.2
v1.6.3
v1.6.4
v1.6.5
v1.6.6
v1.6.7
v1.6.8
/tmp/gopathJJGZf/containerd$ git tag --contains 86bec213720b54bf9ea2813e2c2a577271af58d3
v1.5.11
v1.5.12
v1.5.13
```

So use the smallest versions out of them.

PiperOrigin-RevId: 480965567
@golang golang locked and limited conversation to collaborators Feb 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants