All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] go-helloworld: disable module-aware mode
@ 2021-03-22  3:23 Changqing Li
  2021-03-22 17:17 ` [OE-core] " Konrad Weihmann
  0 siblings, 1 reply; 3+ messages in thread
From: Changqing Li @ 2021-03-22  3:23 UTC (permalink / raw)
  To: openembedded-core

From: Changqing Li <changqing.li@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.

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.li@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() {
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] go-helloworld: disable module-aware mode
  2021-03-22  3:23 [PATCH] go-helloworld: disable module-aware mode Changqing Li
@ 2021-03-22 17:17 ` Konrad Weihmann
  2021-03-23  2:15   ` Changqing Li
  0 siblings, 1 reply; 3+ messages in thread
From: Konrad Weihmann @ 2021-03-22 17:17 UTC (permalink / raw)
  To: openembedded-core, changqing.li

On 22.03.21 04:23, Changqing Li wrote:
> From: Changqing Li <changqing.li@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.
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.li@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() {
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] go-helloworld: disable module-aware mode
  2021-03-22 17:17 ` [OE-core] " Konrad Weihmann
@ 2021-03-23  2:15   ` Changqing Li
  0 siblings, 0 replies; 3+ messages in thread
From: Changqing Li @ 2021-03-23  2:15 UTC (permalink / raw)
  To: Konrad Weihmann, openembedded-core

[-- Attachment #1: Type: text/plain, Size: 2516 bytes --]


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.li@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.li@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() {
>>
>>
>>
>>
>>
>
> 
>

[-- Attachment #2: Type: text/html, Size: 4842 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-23  2:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22  3:23 [PATCH] go-helloworld: disable module-aware mode Changqing Li
2021-03-22 17:17 ` [OE-core] " Konrad Weihmann
2021-03-23  2:15   ` Changqing Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.