git: b42522214dcc - main - Mk/Uses/go.mk: Fix go-post-extract for legacy mode builds

From: Dmitri Goutnik <dmgk_at_FreeBSD.org>
Date: Wed, 03 Aug 2022 21:35:43 UTC
The branch main has been updated by dmgk:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b42522214dcc52b9a932af5661d38d426a5b8adb

commit b42522214dcc52b9a932af5661d38d426a5b8adb
Author:     Dmitri Goutnik <dmgk@FreeBSD.org>
AuthorDate: 2022-08-03 20:24:51 +0000
Commit:     Dmitri Goutnik <dmgk@FreeBSD.org>
CommitDate: 2022-08-03 21:35:13 +0000

    Mk/Uses/go.mk: Fix go-post-extract for legacy mode builds
    
    USES=go may set Go version for legacy (pre-module) builds too.
---
 Mk/Uses/go.mk | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Mk/Uses/go.mk b/Mk/Uses/go.mk
index ecb6d61c7f9b..91ac5740cf95 100644
--- a/Mk/Uses/go.mk
+++ b/Mk/Uses/go.mk
@@ -190,12 +190,7 @@ go-post-fetch:
 .  endif
 
 _USES_extract+=	800:go-post-extract
-.  if empty(go_ARGS)
-# Legacy (GOPATH) build mode, setup directory structure expected by Go for the main module.
-go-post-extract:
-	@${MKDIR} ${GO_WRKSRC:H}
-	@${LN} -sf ${WRKSRC} ${GO_WRKSRC}
-.  elif ${go_ARGS:Mmodules} && defined(GO_MODULE)
+.  if ${go_ARGS:Mmodules} && defined(GO_MODULE)
 # Module-aware build mode. Although not strictly necessary (all build dependencies should be
 # already in MODCACHE), vendor them so we can patch them if needed.
 go-post-extract:
@@ -203,6 +198,11 @@ go-post-extract:
 	@(cd ${GO_WRKSRC}; ${SETENV} ${GO_ENV} GOPROXY=${GO_MODCACHE} ${GO_CMD} mod tidy -e)
 	@${ECHO_MSG} "===> Vendoring ${GO_MODNAME} dependencies";
 	@(cd ${GO_WRKSRC}; ${SETENV} ${GO_ENV} GOPROXY=${GO_MODCACHE} ${GO_CMD} mod vendor -e)
+.  else
+# Legacy (GOPATH) build mode, setup directory structure expected by Go for the main module.
+go-post-extract:
+	@${MKDIR} ${GO_WRKSRC:H}
+	@${LN} -sf ${WRKSRC} ${GO_WRKSRC}
 .  endif
 
 .  if !target(do-build) && empty(go_ARGS:Mno_targets)