tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Patching Go software
Hey Jonathan,
Am 20.02.24 um 17:07 schrieb Jonathan Perkin:
Packaging golang software is becoming increasingly frustrating. One of
the main problems we have with the current setup is that it appears to
be impossible to patch dependencies.
This is indeed hard at the moment.
However, it appears that all of these extracted files are completely
redundant. During the build go will unpack its own copies from GOPROXY
into ${WRKDIR}/.gopath:
This is also true. The extraction is redundant, it's there because I did
not know how to make it skip extraction of module zip files.
However! I recently raised https://github.com/golang/go/issues/64853
about the misleading "downloading" message during Go builds. I got the
feedback that we are doing the wrong thing by populating a local module
proxy, and that we should instead populate a GOMODCACHE with extracted
module contents. I still need to look into how to do that, but I assume
once we have that, patching dependencies will be easier.
work/.gopath/pkg/mod/github.com/sassoftware/go-rpmutils@v0.2.0/fileutil/fileutil_unix.go
and even if I try to patch that file after the build fails, go just
extracts a brand new unmodified version in place.
That's true too. You have the go.sum file and the GOSUMDB network access
(yeah I know), which verifies that you do have unmodified modules.
Do we have anyone who understands go who can answer why we unpack
GO_MODULE_FILES into WRKDIR if they're just going to be ignored, and
ideally how we can patch vendor dependencies?
You can insert a replace directive at the end of go.mod, like so:
replace github.com/sassoftware/go-rpmutils =>
../github.com/sassoftware/go-rpmutils@v0.2.0
That will force the build to use your unpacked version.
It's not helped by golang upstreams becoming increasingly hostile
towards non-Linux platforms, so this is only going to get worse.
This behavior is absolute nonsense, but unfortunately not new :(
Remember the time when Firefox refused to accept some very simple NetBSD
/ OpenBSD patches because "we only care about Linux, Windows and macOS"?
(Ironically, I am writing this in Thunderbird on Linux, of all things.)
--
Benny
Home |
Main Index |
Thread Index |
Old Index