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
F103271237: D20813.diff
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
Unknown Object (File)
Wed, Nov 6, 2:14 PM
Unknown Object (File)
Wed, Nov 6, 12:35 PM
Unknown Object (File)
Wed, Nov 6, 6:47 AM

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
Lint Not Applicable
Unit
Tests Not Applicable

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.