go-helloworld: disable module-aware mode
PATCH 1/1 go-helloworld: disable module-aware mode
From: Changqing Li <[email protected]>
From go 1.16, module-aware mode is enabled by default, regardless of whether a go.mod file is present in the current working directory or a parent directory.
Above change makes go-helloworld build fail when doing offline build or proxy.golang.org is not accessible.
This fix is kind of workaround, as from go1.17, GOPATH mode will be dropped, and GO111MODULE is ignored.
--- meta/recipes-extended/go-examples/go-helloworld_0.1.bb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
meta/recipes-extended/go-examples/go-helloworld_0.1.bb +3 -2
@@ -6,14 +6,15 @@ LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" SRC_URI = "git://${GO_IMPORT}" -SRCREV = "bcf50bfd7dcd8020c90965747d857ae42802e0c5" +SRCREV = "46695d81d1fae905a270fb7db8a4d11a334562fe" UPSTREAM_CHECK_COMMITS = "1" GO_IMPORT = "github.com/golang/example" GO_INSTALL = "${GO_IMPORT}/hello" GO_WORKDIR = "${GO_INSTALL}" +export GO111MODULE="off" -inherit go-mod +inherit go # This is just to make clear where this example is do_install_append() {
Signature · 1 line
2.30.1
Quoted 8 lines · Changqing Li
From: Changqing Li <[email protected]>
From go 1.16, module-aware mode is enabled by default, regardless of
whether a go.mod file is present in the current working directory or a parent directory.Above change makes go-helloworld build fail when doing offline build or proxy.golang.org is not accessible.
I'm not a go expert, but I understood the changelog [1] differently and IMO export GO111MODULE="auto" would restore the same behavior as before the update to go 1.16. And if not it would make the whole go-mod.bbclass somehow obsolete, right - so it should be removed, or at least a sanity check should be added, that the class is not safe to be used with BB_NO_NETWORK
[1] https://blog.golang.org/go116-module-changes
Quoted 36 lines
This fix is kind of workaround, as from go1.17, GOPATH mode will be dropped, and GO111MODULE is ignored.
Signed-off-by Changqing Li <[email protected]>--- meta/recipes-extended/go-examples/go-helloworld_0.1.bb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)meta/recipes-extended/go-examples/go-helloworld_0.1.bb +3
-2@@ -6,14 +6,15 @@ LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" SRC_URI = "git://${GO_IMPORT}" -SRCREV = "bcf50bfd7dcd8020c90965747d857ae42802e0c5" +SRCREV = "46695d81d1fae905a270fb7db8a4d11a334562fe" UPSTREAM_CHECK_COMMITS = "1" GO_IMPORT = "github.com/golang/example" GO_INSTALL = "${GO_IMPORT}/hello" GO_WORKDIR = "${GO_INSTALL}" +export GO111MODULE="off" -inherit go-mod +inherit go # This is just to make clear where this example is do_install_append() {
Quoted 9 lines · Konrad Weihmann
[Please note: This e-mail is from an EXTERNAL e-mail address]
Quoted 6 lines · Changqing Li
From: Changqing Li <[email protected]>
From go 1.16, module-aware mode is enabled by default, regardless of whether a go.mod file is present in the current working directory or a parent directory.
Quoted 6 lines
Quoted 2 lines
Above change makes go-helloworld build fail when doing offline build or proxy.golang.org is not accessible.
I'm not a go expert, but I understood the changelog [1] differently and IMO export GO111MODULE="auto" would restore the same behavior as before the update to go 1.16.
when GO111MODULE="auto" , actually to use "off" mode (GPPATH mode) or
"on" mode(module-aware mode) is decided by existing of "go.mod".
after revert SRCREV, there is no go.mod. so it works in off mode actually. so, set it directly to off here.
set to "auto" also works.
Quoted 45 lines
And if not it would make the whole go-mod.bbclass somehow obsolete, right - so it should be removed, or at least a sanity check should be added, that the class is not safe to be used with
BB_NO_NETWORK[1] https://blog.golang.org/go116-module-changes
Quoted 36 lines
This fix is kind of workaround, as from go1.17, GOPATH mode will be dropped, and GO111MODULE is ignored.
Signed-off-by Changqing Li <[email protected]>---
meta/recipes-extended/go-examples/go-helloworld_0.1.bb | 5 +++--1 file changed, 3 insertions(+), 2 deletions(-)meta/recipes-extended/go-examples/go-helloworld_0.1.bb +0
-0@@ -6,14 +6,15 @@ LICENSE = "MIT"
LIC_FILES_CHKSUM= "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI= "git://${GO_IMPORT}"meta/recipes-extended/go-examples/go-helloworld_0.1.bb +1
-1-SRCREV = "bcf50bfd7dcd8020c90965747d857ae42802e0c5" +SRCREV = "46695d81d1fae905a270fb7db8a4d11a334562fe"
UPSTREAM_CHECK_COMMITS= "1"
GO_IMPORT= "github.com/golang/example"
GO_INSTALL= "${GO_IMPORT}/hello"
GO_WORKDIR= "${GO_INSTALL}"meta/recipes-extended/go-examples/go-helloworld_0.1.bb +2
-1+export GO111MODULE="off" -inherit go-mod +inherit go# This is just to make clear where this example is
do_install_append(){