Page MenuHomeFreeBSD

Mk/Uses/go.mk: Default to "." (the current package) instead of PORTNAME
ClosedPublic

Authored by dmgk on Jun 30 2019, 9:33 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 25, 1:06 AM
Unknown Object (File)
Sun, Nov 24, 4:24 AM
Unknown Object (File)
Sat, Nov 23, 7:28 PM
Unknown Object (File)
Fri, Nov 22, 9:40 PM
Unknown Object (File)
Fri, Nov 22, 4:55 AM
Unknown Object (File)
Thu, Nov 21, 10:21 AM
Unknown Object (File)
Fri, Nov 8, 8:32 PM
Unknown Object (File)
Thu, Nov 7, 2:28 PM

Details

Summary

If neither GO_PKGNAME or GO_TARGET is set explicitly, go install tries to install package named ${PORTNAME} which
is almost always wrong. This forces Go ports to set GO_PKGNAME or GO_TARGET although their value is often redundant.

Update do-build target to default to the . package instead ("the package in the current directory") and teach do-install
to install . package. In many cases, this removes the need to explicitly set GO_PKGNAME and GO_TARGET making
USES=go:modules alone sufficient for simpler ports.

This is a backward compatible change so no exp-run should be needed. Tested with poudriere bulk of all Go ports @ r505345.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 25213
Build 23892: arc lint + arc unit

Event Timeline

Request maintainership.

Any thoughts/feedback on this? Should I request an exp-run to get this moving forward?
Otherwise I believe this can be committed with maintainer timeout (17 days).

  1. If GO_PKGNAME=${PORTNAME} is almost always wrong then why are we setting it like that?
  2. Can you give some examples of ports where this would simplify things? I'm too lazy to figure out which ports this applies to by myself.
  3. It would be nice if @jlaffaye could sign off on the maintainership transfer.
  1. If GO_PKGNAME=${PORTNAME} is almost always wrong then why are we setting it like that?
  2. Can you give some examples of ports where this would simplify things? I'm too lazy to figure out which ports this applies to by myself.
  3. It would be nice if @jlaffaye could sign off on the maintainership transfer.
  1. I'm not sure why PORTNAME was choosen as the default for GO_PKGNAME/GO_TARGET, there are no ports where these defaults would result in a buildable configuration. Because of this, ports either explicitily set GO_PKGNAME or it gets inferred from GH_SUBDIR, usually github.com/${GH_ACCOUNT}/${PORTNAME} or similar. But because most upstreams are designed to be "go gettable", ${WRKSRC} already contains Go package named ${GO_PKGNAME} so go instal ${GO_PKGNAME} becomes a synonym for go install . For module-aware upstreams where GOPATH doesn't matter, GO_PKGNAME becomes just redundant.
  2. Any port that uses go modules and has buildable artifacts in ${WRKSRC} won't need GH_SUBDIR/GO_PKGNAME/GO_TARGET (ex. devel/bingo, devel/git-lfs). Ports that put executables in e.g. ./cmd will need just GO_TARGET=./cmd/foo.
This revision was not accepted when it landed; it landed in state Needs Review.Jul 26 2019, 7:15 AM
This revision was automatically updated to reflect the committed changes.