Skip to content

Comments

treewide, affected packages: fix build with golang 1.16#14886

Merged
neheb merged 8 commits intoopenwrt:masterfrom
cotequeiroz:golang
Feb 25, 2021
Merged

treewide, affected packages: fix build with golang 1.16#14886
neheb merged 8 commits intoopenwrt:masterfrom
cotequeiroz:golang

Conversation

@cotequeiroz
Copy link
Member

Maintainers: @gekmihesg @jefferyto @dangowrt @aparcar @G-M0N3Y-2503
Compile tested: mvebu, arm_cortex-a9+vfpv3-d16, openwrt master
Run tested: none
Description:
Golang 1.16 changed the default package build mode to "module-aware" mode. The intention is to drop GOPATH mode (opposite of module-aware) in go 1.17. See https://blog.golang.org/go116-module-changes

To enable GOPATH mode, this PR adds GO111MODULE=auto to GO_PKG_BUILD_VARS. Affected packages are

  • restic-rest-server
  • tor-fw-helper
  • cni
  • containerd
  • docker
  • dockerd
  • libnetwork
  • oci-runtime-tools

Sample error messages

Finding targets
no required module provides package github.com/containernetworking/cni/cnitool: working directory is not part of a module

Building targets
go: cannot find main module; see 'go help modules'
go: cannot find main module, but found vendor.conf in /builder/shared-workdir/build/sdk/build_dir/target-mipsel_24kc_musl/containerd-1.4.3/.go_work/build/src/github.com/containerd/containerd
	to create a module there, run:
	go mod init
Makefile:193: recipe for target 'bin/ctr' failed

Fixes #14879

Add GO111MODULE=auto to GO_PKG_BUILD_VARS to allow the package to be
built in non-module mode.

Module-aware mode will be mandatory in the next golang release.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Add GO111MODULE=auto to GO_PKG_BUILD_VARS to allow the package to be
built in non-module mode.

Module-aware mode will be mandatory in the next golang release.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Add GO111MODULE=auto to GO_PKG_BUILD_VARS to allow the package to be
built in non-module mode.

Module-aware mode will be mandatory in the next golang release.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Add GO111MODULE=auto to GO_PKG_BUILD_VARS to allow the package to be
built in non-module mode.

Module-aware mode will be mandatory in the next golang release.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Add GO111MODULE=auto to GO_PKG_BUILD_VARS to allow the package to be
built in non-module mode.

Module-aware mode will be mandatory in the next golang release.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
@aparcar
Copy link
Member

aparcar commented Feb 24, 2021

LGTM

@G-M0N3Y-2503
Copy link
Contributor

It doesn't look like the PKG_RELEASE was bumped for dockerd.

But the others LGTM.

Add GO111MODULE=auto to GO_PKG_BUILD_VARS to allow the package to be
built in non-module mode.

Module-aware mode will be mandatory in the next golang release.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Add GO111MODULE=auto to GO_PKG_BUILD_VARS to allow the package to be
built in non-module mode.

Module-aware mode will be mandatory in the next golang release.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Add GO111MODULE=auto to GO_PKG_BUILD_VARS to allow the package to be
built in non-module mode.

Module-aware mode will be mandatory in the next golang release.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
@cotequeiroz
Copy link
Member Author

dockerd should be fixed now. Thanks for spotting this.

@neheb neheb merged commit ea190c2 into openwrt:master Feb 25, 2021
@cotequeiroz cotequeiroz deleted the golang branch September 26, 2022 12:31
@BKPepe
Copy link
Member

BKPepe commented Oct 5, 2023

@cotequeiroz , @jefferyto since we are now using Golang 1.21 in OpenWrt master branch and as well OpenWrt 23.05, we can drop GO111MODULE=auto from Makefiles, right? It seems like leftover now. I know... 2 years later:-)

@jefferyto
Copy link
Member

It depends on each affected package, if they have updated to using Go modules. I think most Go projects have switched, though I believe docker still has not.

tor-fw-helper has not but it also hasn't been updated in years; maybe it would be better to remove that package entirely instead.

@BKPepe
Copy link
Member

BKPepe commented Oct 5, 2023

After two years? Definitely, they updated it. If not, it needs to be reported to them. That sounds like easy job, isn't it? :)

Ok, let's drop tor-fw-helper. I will prepare PR in a sec.

@BKPepe BKPepe mentioned this pull request Oct 5, 2023
@jefferyto
Copy link
Member

After two years? Definitely, they updated it. If not, it needs to be reported to them. That sounds like easy job, isn't it? :)

docker/cli#4116 (comment)

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

Successfully merging this pull request may close these issues.

golang: 1.16 update breaks dependent packages

6 participants