moby: non-standard vendor/ approach breaks building with Buildroot
Description
https://github.com/moby/moby/pull/44615#issuecomment-1343519928 https://github.com/moby/moby/issues/44614
The old releases pre-v23.x worked correctly with GO111MODULE=on.
The new releases which use a custom approach to managing vendor/ do not:
$ go build -mod=vendor github.com/docker/docker/cmd/dockerd
go: inconsistent vendoring in docker-engine-:
cloud.google.com/go@v0.102.1: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
cloud.google.com/go/compute@v1.7.0: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
cloud.google.com/go/logging@v1.4.2: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
code.cloudfoundry.org/clock@v1.0.0: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
[snip]
To ignore the vendor directory, use -mod=readonly or -mod=mod.
To sync the vendor directory, run:
go mod vendor
Disabling go modules with GO111MODULE=off doesn’t fix it either:
After applying the following changes to buildroot:
- Set GO111MODULE=off
- Remove -modcacherw flag
- Change path passed to
go build
from the module path to./cmd/dockerd
.
It still doesn’t work, since Go doesn’t recognize vendor/ anymore:
$ cd ./path/to/docker-engine
$ GO111MODULE=off go build -v ./cmd/dockerd
cmd/dockerd/daemon_unix.go:22:2: cannot find package "golang.org/x/sys/unix" in any of:
/lib/go/src/golang.org/x/sys/unix (from $GOROOT)
/host/share/go-path/src/golang.org/x/sys/unix (from $GOPATH)
The buildroot build infrastructure is here:
- https://github.com/buildroot/buildroot/blob/master/package/pkg-golang.mk#L43
- https://github.com/buildroot/buildroot/blob/master/package/docker-engine/docker-engine.mk
My request is to please play nice with the Go modules system and either go back to the way this worked before (which worked perfectly) or provide some solution for us which doesn’t involve completely changing the Go package infrastructure in Buildroot for a single package.
Reproduce
- Try to build with
GO111MODULE=off
Expected behavior
No response
docker version
N/A
docker info
N/A
Additional Info
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (9 by maintainers)
Commits related to this issue
- package/docker-engine: bump version to v23.0.0 This update requires a workaround for the non-standard vendor/ structure in the docker-engine repository, which has an invalid vendor/modules.txt file. ... — committed to skiffos/buildroot by paralin 2 years ago
- package/docker-cli: bump version to v23.0.0 This update requires a workaround for the non-standard vendor/ structure in the docker-engine repository, which has an invalid vendor/modules.txt file. Re... — committed to skiffos/buildroot by paralin a year ago
- package/docker-engine: bump version to v23.0.0 This update requires a workaround for the non-standard vendor/ structure in the docker-engine repository, which has an invalid vendor/modules.txt file. ... — committed to skiffos/buildroot by paralin 2 years ago
- package/docker-cli: bump version to v23.0.0 This update requires a workaround for the non-standard vendor/ structure in the docker-engine repository, which has an invalid vendor/modules.txt file. Re... — committed to skiffos/buildroot by paralin a year ago
- package/docker-engine: bump version to v23.0.0 This update requires a workaround for the non-standard vendor/ structure in the docker-engine repository, which has an invalid vendor/modules.txt file. ... — committed to skiffos/buildroot by paralin 2 years ago
- package/docker-cli: bump version to v23.0.0 This update requires a workaround for the non-standard vendor/ structure in the docker-engine repository, which has an invalid vendor/modules.txt file. Re... — committed to skiffos/buildroot by paralin a year ago
- package/docker-engine: bump version to v23.0.0 This update requires a workaround for the non-standard vendor/ structure in the docker-engine repository, which has an invalid vendor/modules.txt file. ... — committed to skiffos/buildroot by paralin 2 years ago
- package/docker-cli: bump version to v23.0.0 This update requires a workaround for the non-standard vendor/ structure in the docker-engine repository, which has an invalid vendor/modules.txt file. Re... — committed to skiffos/buildroot by paralin a year ago
- package/docker-engine: bump version to v23.0.0 This update requires a workaround for the non-standard vendor/ structure in the docker-engine repository, which has an invalid vendor/modules.txt file. ... — committed to skiffos/buildroot by paralin 2 years ago
- package/docker-cli: bump version to v23.0.0 This update requires a workaround for the non-standard vendor/ structure in the docker-engine repository, which has an invalid vendor/modules.txt file. Re... — committed to skiffos/buildroot by paralin a year ago
- package/balena-engine: bump to version 20.10.26 This update requires a workaround for the non-standard vendor/ structure in the balena-engine repository, which has an invalid vendor/modules.txt file.... — committed to skiffos/buildroot by paralin a year ago
- package/docker-engine: bump version to v23.0.0 This update requires a workaround for the non-standard vendor/ structure in the docker-engine repository, which has an invalid vendor/modules.txt file. ... — committed to skiffos/buildroot by paralin 2 years ago
- package/docker-cli: bump version to v23.0.0 This update requires a workaround for the non-standard vendor/ structure in the docker-engine repository, which has an invalid vendor/modules.txt file. Re... — committed to skiffos/buildroot by paralin a year ago
- package/balena-engine: bump to version 20.10.26 This update requires a workaround for the non-standard vendor/ structure in the balena-engine repository, which has an invalid vendor/modules.txt file.... — committed to skiffos/buildroot by paralin a year ago
- package/balena-engine: bump to version 20.10.26 This update requires a workaround for the non-standard vendor/ structure in the balena-engine repository, which has an invalid vendor/modules.txt file.... — committed to skiffos/buildroot by paralin a year ago
- package/docker-engine: bump version to v23.0.0 This update requires a workaround for the non-standard vendor/ structure in the docker-engine repository, which has an invalid vendor/modules.txt file. ... — committed to skiffos/buildroot by paralin 2 years ago
- package/docker-cli: bump version to v23.0.0 This update requires a workaround for the non-standard vendor/ structure in the docker-engine repository, which has an invalid vendor/modules.txt file. Re... — committed to skiffos/buildroot by paralin a year ago
- package/balena-engine: bump to version 20.10.26 This update requires a workaround for the non-standard vendor/ structure in the balena-engine repository, which has an invalid vendor/modules.txt file.... — committed to skiffos/buildroot by paralin a year ago
- package/docker-engine: bump version to v23.0.0 This update requires a workaround for the non-standard vendor/ structure in the docker-engine repository, which has an invalid vendor/modules.txt file. ... — committed to skiffos/buildroot by paralin 2 years ago
- package/docker-cli: bump version to v23.0.0 This update requires a workaround for the non-standard vendor/ structure in the docker-engine repository, which has an invalid vendor/modules.txt file. Re... — committed to skiffos/buildroot by paralin a year ago
go modules solved “some” issues, but in doing so effectively broke backward compatibility. We still have a LOT of work to do to make this happen (including a rename); we also need to refactor and restructure many of our packages to reduce dependency hell for consumers of the repository (before go modules, it was easier to ignore dependencies that you didn’t need, with go modules, all of our dependencies (versions) are enforces on users, which can complicate things as we also have some circular dependencies). But we want to make that transition, as without being a go modules, users of our code as a dependency must jump through a lot of hoops to be able to use it.
But yeah, go modules cause many breaking changes (they’re not considered “breaking change” as it’s outside of Go’s v1 compatiblity promise);
go get <some project>
always meant “latest from the default branch”When go modules were introduced, this all changed:
v
in versions) are considered invalid.go get <some project>
no longer defaults to “latest from main / master”, but “latest tag that looks like SemVer”; which in some case means: dependencies get rolled back to a tag from years ago.go modules allow for “invalid” versions, as long as there’s no
go.mod
file in the repository; the moment that file is added, it is no longer importable (which is why we’re usingvendor.mod
).