Skip to content

Commit

Permalink
Mk/Uses/go.mk: Fix go-post-extract for legacy mode builds
Browse files Browse the repository at this point in the history
USES=go may set Go version for legacy (pre-module) builds too.
  • Loading branch information
dmgk committed Aug 3, 2022
1 parent 3c8549c commit b425222
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Mk/Uses/go.mk
Expand Up @@ -190,19 +190,19 @@ 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:
@${ECHO_MSG} "===> Tidying ${GO_MODNAME} dependencies";
@(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)
Expand Down

0 comments on commit b425222

Please sign in to comment.