Add support for Go default version selection to allow easier ports testing with
lang/go-devel (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238374)
Details
- Reviewers
mat jlaffaye swills tobik - Group Reviewers
O5: Ports Framework (Owns No Changed Paths) portmgr - Commits
- rP504942: Mk/Uses/go.mk: Allow overriding the Go port
Diff Detail
- Repository
- rP FreeBSD ports repository
- Lint
No Lint Coverage - Unit
No Test Coverage - Build Status
Buildable 24783 Build 23539: arc lint + arc unit
Event Timeline
~120 ports unfortunately do not use USES=go and declare a build dependency on lang/go themselves. They should be updated to use GO_DEFAULT too.
I'd advocate for replacing explicit BUILD_DEPENDS with USES=go, even if only for adding a configurable build dependency and giving the port access to GO_ENV and GO_BUILDFLAGS.
We have semi-regular fallouts because ports are missing some build flag or env variable that becomes required in the next Go version (e.g. recent GOCACHE failures), it would be much easier to have these managed in one place. Go 1.13 (which is due in 2 months) will be especially disruptive because of changes to modules handling [1] and (possibly) GOPROXY [2].
[1] https://github.com/golang/go/issues/31857
[2] https://proxy.golang.org/
Well, DEFAULT_VERSIONS is a user facing variable something users can set to choose the version they want to use. I have a feeling this is only for testing purposes, so it would probably be better to patch your local installation. Otherwise, people would end up setting go=go14 and complain things break.
Correct, go-devel is primarily for testing by port maintainers. The idea was to make this testing easier so most failures can be caught and fixed before the new lang/go version lands.
Out of ~250 Go ports we have in the tree ~30 currently fail to build with go-devel and although most fixes are trivial, maintainers have no easy way to do a quick QA with the upcoming version or verify submitted fix - most probably won't bother to modify lang/go or build current Go master branch from sources.
Setting go=go14 would break things and shouldn't be allowed, though it's not clear where would be the best place to add version validation due to the unfortunate 50/50 split between ports using go.mk and not using it. I was hoping that some consensus could be reached and explicit BUILD_DEPENDS=go:lang/go can be replaced with USES=go so all configuration can be managed in one place.
I had the same intentions for GHC (Haskell compiler) and solved it by making PORTVERSION variable overridable. This still allows building different GHC versions, but at the same time hides that fact from regural users.
I would probably change it to:
LANG_GO_PORT?= lang/go BUILD_DEPENDS+= ${GO_CMD}:${LANG_GO_PORT}
or something similar, so that you can set LANG_GO_PORT=lang/go-devel in your make.conf, while preventing users from breaking their systems.
Do not set DEFAULT_VERSION to prevent users breaking their systems by setting go=go14,
add simple Go port selection with GO_PORT instead.
Is this the only reason against using DEFAULT_VERSIONS here? I do not see how GO_PORT would prevent that problem since you can still set it to lang/go14 in make.conf. It is just now obscured and hidden deeper in the framework.
Setting go=go14 would not even remotely work for anything given that lang/go14 installs the go command in a separate prefix outside of the default PATH as /usr/local/go14/bin/go only. Port builds would not even really start with that.
go=go14 could also be explicitly disallowed with some extra code.
Could you add a note about GO_PORT to the top of go.mk and make it clear that it can only be set in make.conf for testing purposes and not by individual ports [1]? Otherwise we will probably see port submissions that set GO_PORT=lang/go14.
[1] (N.B. At least with GO_DEFAULT the framework would have code in place to prevent that already.)