On 3/23/21 1:17 AM, Konrad Weihmann wrote:
[Please note: This e-mail is from an EXTERNAL e-mail address]

On 22.03.21 04:23, Changqing Li wrote:
From: Changqing Li <changqing...@windriver.com>

 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.

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.

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


This fix is kind of workaround, as from go1.17, GOPATH mode will be
dropped, and GO111MODULE is ignored.

Signed-off-by: Changqing Li <changqing...@windriver.com>
---
  meta/recipes-extended/go-examples/go-helloworld_0.1.bb | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-extended/go-examples/go-helloworld_0.1.bb b/meta/recipes-extended/go-examples/go-helloworld_0.1.bb
index d3f7525dc9..c51f163e9b 100644
--- a/meta/recipes-extended/go-examples/go-helloworld_0.1.bb
+++ b/meta/recipes-extended/go-examples/go-helloworld_0.1.bb
@@ -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() {








-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#149807): 
https://lists.openembedded.org/g/openembedded-core/message/149807
Mute This Topic: https://lists.openembedded.org/mt/81516655/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to