Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v4 1/7] package/go: implement go modules integration
Date: Sat, 29 Aug 2020 20:40:40 +0200	[thread overview]
Message-ID: <20200829204040.11e80d7f@windsurf.home> (raw)
In-Reply-To: <CA+h8R2od7W+QcUVLcdLFiKbaG8voDAbOBvEQDe3rnQF9uAtiyQ@mail.gmail.com>

Hello Christian,

On Sat, 29 Aug 2020 10:32:12 -0700
Christian Stewart <christian@paral.in> wrote:

> GOMOD was not required before. If the go.mod exists (which happens in
> many cases) then you can infer what GOMOD is from the first line of
> the file. So GOMOD absolutely can be empty and was in some of my
> buildroot_ext packages.

No, it cannot be empty, because pkg-golang.mk has something like this:

$(2)_GOMOD ?= $$($(2)_SRC_DOMAIN)/$$($(2)_SRC_VENDOR)/$$($(2)_SRC_SOFTWARE)

So, even if $$($(2)_SRC_DOMAIN), $$($(2)_SRC_VENDOR) and
$$($(2)_SRC_SOFTWARE) are empty, the GOMOD will be equal to //.
Obviously, that's a stupid and non-working GOMOD value, but it's still
non-empty.

> As you're now using it as part of the build targets, requiring it to
> be set is, I guess, fine.

It was already always set, as explained above.

> The mechanism to copy in a go.mod file and/or a go.sum file is used in
> some of my buildroot_ext packages. It's used in many Gentoo packages
> as well, iirc. However, as the Buildroot mainline currently does not
> use the Go compiler to download any dependencies (instead relying on a
> "vendor" dir to exist in the source repository), this doesn't make any
> difference yet in Buildroot.

Yes, in principle I don't see a problem with adding support for that,
but (1) it was not used anywhere and (2) it was not documented anywhere.

> Thank you for the work to review, split, & cleanup, the attention to
> detail in Buildroot is on the highest level.

By splitting things up, it also help understand better what was going
on.

> > Are you sure this GOPATH is needed ? We're supposed to move away from
> > GOPATH, but you're adding a new GOPATH location here, and in a build
> > that has all our Go packages enabled, this
> > $(HOST_DIR)/usr/share/go-path location doesn't even exist.
> >
> > Could you clarify ?  
> 
> Currently the Go compiler will use $GOPATH/pkg/{mod,sumdb} for the Go
> modules cache. It probably did not create any in the mainline
> Buildroot builds because there is no Go module activity in use yet
> (all vendor based). However, a valid GOPATH does need to be set so
> that the Go compiler can use it for the "pkg" cache dir if necessary.
> 
> So, GOPATH, while not used for lookups of packages under the "src" dir
> anymore, is still used for a few other directories for Go.
> 
> There is a new variable in newer versions of Go to control this
> separately from GOPATH, so we can add that and eventually fully remove
> GOPATH (but not yet).
> 
> GOMODCACHE="$GOPATH/pkg/mod"

OK, thanks for the additional explanations.

What are the next steps in terms of Go support ? Are there projects
where the "vendor" dependencies are not included as part of the
upstream project, and need to be downloaded by go at build time ? If
so, do we want to support that ? How ? Do you have examples of
prominent Go projects that are delivered like this ?

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2020-08-29 18:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-13 21:32 [Buildroot] [PATCH v4 1/7] package/go: implement go modules integration Christian Stewart
2020-08-13 21:32 ` [Buildroot] [PATCH v4 2/7] package/runc: remove unnecessary workspace identifier Christian Stewart
2020-08-13 21:32 ` [Buildroot] [PATCH v4 3/7] package/docker-containerd: fix go-module package identifier/targets Christian Stewart
2020-08-29 13:01   ` [Buildroot] [PATCH v4 3/7] package/docker-containerd: fix go-module package identifier/target Thomas Petazzoni
2020-08-13 21:32 ` [Buildroot] [PATCH v4 4/7] package/docker-engine: fix go-module package identifier Christian Stewart
2020-08-13 21:32 ` [Buildroot] [PATCH v4 5/7] package/docker-cli: " Christian Stewart
2020-08-13 21:32 ` [Buildroot] [PATCH v4 6/7] package/docker-proxy: " Christian Stewart
2020-08-13 21:32 ` [Buildroot] [PATCH v4 7/7] package/mender-artifact: fix go-module package build target Christian Stewart
2020-08-13 21:45 ` [Buildroot] [PATCH v4 1/7] package/go: implement go modules integration Thomas Petazzoni
2020-08-13 21:52   ` Christian Stewart
2020-08-28 18:30 ` Christian Stewart
2020-08-29  8:57 ` Arnout Vandecappelle
2020-08-29 12:59 ` Thomas Petazzoni
2020-08-29 17:32   ` Christian Stewart
2020-08-29 18:40     ` Thomas Petazzoni [this message]
2020-08-29 13:04 ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200829204040.11e80d7f@windsurf.home \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox