Hi,
Currently in go.port.mk we set ALL_TARGET based on the existence of GH_*
vars. This is handy, but when GH_* are not defined, ALL_TARGET defaults
to "all" which completely breaks GOPATH as it ends up as
${WRKDIR}/go/src/all, which prevents sub-modules from being detected
even though they are right there in the all dir).
As it stands now, it isn't obvious that users need to set ALL_TARGET to
get things working, so instead, WRK* vars are diddled until things
work.
This diff breaks non-GH_*'d go packages that currently do not have
ALL_TARGET set, but the fix is trivial. Obviously there would need to be
a round of fixes for every Go port.
For example net/syncthing:
----->8-----
diff --git a/net/syncthing/Makefile b/net/syncthing/Makefile
index f439d2674e7..d80b8441e27 100644
--- a/net/syncthing/Makefile
+++ b/net/syncthing/Makefile
@@ -19,7 +19,7 @@ WANTLIB += c pthread
MASTER_SITES = https://github.com/syncthing/syncthing/releases/download/v${V}/
WRKDIST = ${WRKDIR}/syncthing
-WRKSRC = ${WRKDIR}/go/src/github.com/syncthing/syncthing
+ALL_TARGET = github.com/syncthing/syncthing
SUBST_VARS += VARBASE
MODULES = lang/go
-----8<-----
Here is the diff:
diff --git a/lang/go/go.port.mk b/lang/go/go.port.mk
index 1a5827dbe23..cc1a3b6cfc7 100644
--- a/lang/go/go.port.mk
+++ b/lang/go/go.port.mk
@@ -35,6 +35,11 @@ MODGO_TEST_CMD += -ldflags="${MODGO_LDFLAGS}"
.if defined(GH_ACCOUNT) && defined(GH_PROJECT)
ALL_TARGET ?= github.com/${GH_ACCOUNT}/${GH_PROJECT}
.endif
+
+.if ! defined(ALL_TARGET)
+ERRORS += "Fatal: please set ALL_TARGET to the Go package path of ${PKGNAME}"
+.endif
+
TEST_TARGET ?= ${ALL_TARGET}
SEPARATE_BUILD ?= Yes
--
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A 4AF0 1F81 112D 62A9 ADCE