From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Bryce Johnson <bryce@redpinelabs.com>
Cc: christian@aperture.us, buildroot@buildroot.org
Subject: Re: [Buildroot] Using a go.mod in a subdirectory
Date: Sat, 24 Jun 2023 17:27:13 +0200 [thread overview]
Message-ID: <20230624152713.GY24952@scaer> (raw)
In-Reply-To: <CADXxVSKVs-LQ7we1DPQ3oN46ONQ-d56Cza8zRZ=2HyTGZ-bTow@mail.gmail.com>
Bryce, All,
On 2023-06-23 10:59 -0600, Bryce Johnson spake thusly:
> Hi All,
> I was looking at adding a package for shellhub in buildroot. Two
> issues, first one is that the latest needs go 1.20. I applied this
> patch (https://patchwork.ozlabs.org/project/buildroot/list/?series=358451)
> to get around that which seems to work so far. CC: Christian since
> I'm testing with his patch set.
>
> The 2nd issue is the agent is in a subdirectory with its own go.mod
> that is different from one the on the root directory.
>
> Is there a way to do this better? Or is the go.mod required to be in
> the root of the repo?
When we introduced the go-package infra, we made the assumption that go
would be finely-grained packaged, with one single "go package" per
source tree, and that it would be at the root of the source tree.
The result of these assumptions are clearly visible in two location:
- support/download/go-post-process expects that the vendoring and the
go.mod are both at the root of the source tree; see lines 18 and 27;
- package/pkg-golang.mk also expects that the go package lies at the
root; see lines 111, 123, 139, and 148.
This restriction could certainly be lifted if support for FOO_SUB_DIR
was to be added to the go-package infra, but it is not straightforward.
When that is done, you'd need a buildroot package for each sub-part of
shellhub you need. Of course, in such a case, even though the different
parts would come from the same source tree, we could not share the
generated source archive with _DL_SUBDIR, becasue the different parts
would not be vendored similarly).
> SHELLHUB_VERSION = v0.12.3
> SHELLHUB_SITE = $(call github,shellhub-io,shellhub,$(SHELLHUB_VERSION))
We try to keep a "clean" version string without the decorum used to make
it a git tag, and make that part of the site URL, e.g.:
SHELLHUB_VERSION = 0.12.3
SHELLHUB_SITE = $(call github,shellhub-io,shellhub,v$(SHELLHUB_VERSION))
Regards,
Yann E. MORIN.
> SHELLHUB_LICENSE = Apache-2.0
> SHELLHUB_LICENSE_FILES = LICENSE.md
> SHELLHUB_DEPENDENCIES = libxcrypt
>
> SHELLHUB_GOMOD = github.com/shellhub-io/shellhub/agent
> SHELLHUB_LDFLAGS = -X main.AgentVersion=${SHELLHUB_VERSION}
>
> # SHELLHUB_BUILD_TARGETS = agent
> # SHELLHUB_INSTALL_BINS = $(notdir $(SHELLHUB_BUILD_TARGETS))
>
> $(eval $(golang-package))
>
>
> I can export my output/host/usr/bin and do go build -ldflags "-X
> main.AgentVersion=v0.12.3" and it is able to build in that way, so it
> seems the host-go 1.20 patch is working.
>
> Bryce
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2023-06-24 15:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-23 16:59 [Buildroot] Using a go.mod in a subdirectory Bryce Johnson
2023-06-24 15:27 ` Yann E. MORIN [this message]
2023-06-26 13:19 ` Bryce Johnson
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=20230624152713.GY24952@scaer \
--to=yann.morin.1998@free.fr \
--cc=bryce@redpinelabs.com \
--cc=buildroot@buildroot.org \
--cc=christian@aperture.us \
/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