-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: declare a standard for packaging Go for downstream distributions #48548
Comments
Hi, I'm the maintainer for Gentoo. We do not install the testdata directories because they are only used when
If I need to install the testdata directories, I can, but I'll also need to look for a setting that tells our pm to ignore these files rather than checking them for writable/executable sections. |
I noticed this too when Arch updated its package (but didn't report it as I wasn't sure it affected anything other than One thing to note is that the 100 MB that the packaging change quotes (archlinux/svntogit-community@fe2390f#diff-37538beb61ff63edebbf735dfcf39e5d732f49183d6beb097169d971875ca422R65) is largely due to the dropping of files in If I remove the
This to me says that the tests in particular aren't the main contributor of bloat, but other prebuilt things. IIRC, there's an issue that talks about changing the official Go distribution to drop things that are effectively obsolete with the build cache being required; perhaps that's a related discussion and the unused files can be a part of a general packaging recommendation. |
Indeed, that's #47257. I think that would be the precedent for downstream packagers to also remove prebuilt packages from |
It's perhaps worth noting that all of these are false positives. The complaint here is that these are object files that are missing a |
Change https://golang.org/cl/352450 mentions this issue: |
Avoid problems with distro scanning by not using files that look like object files. For #48548 Change-Id: I4a06d5690d0870d6253f176e510faa5eebf2d057 Reviewed-on: https://go-review.googlesource.com/c/go/+/352450 Trust: Ian Lance Taylor <iant@golang.org> Trust: Daniel Martí <mvdan@mvdan.cc> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
IMO we already have a base set of guidelines for packaging Go: the Go project tests against what we ship in the releases at https://golang.org/dl; any deviation from those contents is in some sense not supported by the Go project. |
All of
I don't really know whether |
Regarding test files: I strongly believe that It is certainly reasonable to make that work by including all needed test dependencies. I am not sure whether it is also reasonable to do so by stripping |
Downstream packages have also deviated in other ways, eg Fedora defaulting to |
I'd argue it's not reasonable because then |
For Debian, a recent change has split the package based on:
So that all architectures share a single golang-X.Y-src package which saves some space in the archive. |
Change https://golang.org/cl/362245 mentions this issue: |
Avoid problems with distro scanning by not using files that look like object files. This is a copy of CL 352450 from the main repo. Updates golang/go#48548. Change-Id: I519d0aa73fa46470d1a41ce29a1da046a9f57f3b Reviewed-on: https://go-review.googlesource.com/c/tools/+/362245 Trust: Than McIntosh <thanm@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
I have spent the last hour or so very confused, because it seemed like the system's Go 1.17.1 I installed via Arch was very different from the
go version devel go1.18-051df0d722
I installed from source recently. After much digging, I ended up realising that my 1.17.1 was missing all test files and testdata directories, and this seems to be by design.I filed a bug on the distro in question, and hopefully they'll reconsider. At the very least, they should support some way to install those missing files, because otherwise my install of Go is incomplete;
go test std
gives a weird error and then prints a lot of "no test files" warnings. Similarly,go test all
is (silently) broken for third party modules importing std.I'm raising this issue because I'm very surprised that downstreams are installing partial GOROOTs and giving the impression that they are full and complete Go installs. As far as I am aware, the only way that Go is supported is when the GOROOT is used from a binary distribution, or from the result of
make.bash
without removing files.Unfortunately, it seems like different distributions have their own definitions of a Go install, with varying degrees of what files are included.
Some distros which don't install a full GOROOT:
*_test.go
andtestdata
files.Distros which appear to install an entire GOROOT:
It's also worth noting that some distros split "bin", "src", and "doc" packages. I think I don't have any argument against that, as long as the default install includes all of them.
I understand that it's normal for downstreams to apply light patches to software while packaging. However, I feel like there's a bit of a disconnect happening here: if I install Go with my system's package manager, right now it appears to be a coin toss whether or not that
GOROOT
will be complete with test files and testdata directories. I imagine there might be other inconsistencies too, such as themisc
ordoc
directories.I think it's worthwhile to consider whether we want to be in this situation in the long term. I would say not - it's pretty confusing to the end user.
One way I can imagine we could improve the situation in the long term is for the Go project to define a base set of guidelines for packaging Go. For example, if we declare that it should include
GOROOT/src
without deleting test files, then a common source of variance between distributions would go away. It could also declare whether or not it's OK to omit directories likemisc
,api
, ordoc
.If we go the route of defining a "minimal Go install" which excludes some files such as
*_test.go
andtestdata
, then I reckon that should be properly tested and supported too. Right now, the experience is somewhat poor, asgo test std
fails with[amd64] FuncPCTestFn: function FuncPCTestFn missing Go declaration
.Another route to consider is to reduce the incentive for downstreams to strip files. As far as I have seen, there are two common recurring themes:
I will keep editing this post to correct information or add more distros. Edit log:
golang-tests
package.The text was updated successfully, but these errors were encountered: