aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuangyuan Yang <ygy@FreeBSD.org>2021-11-07 01:26:02 +0000
committerGuangyuan Yang <ygy@FreeBSD.org>2021-11-07 01:29:54 +0000
commit3271400a5e29ce317d8bf66d395c0a4f2a8c0874 (patch)
tree512f60e3d3857a16f8e5c42aa1e17536770164fe
parent9e0171878e2e4eb552a9ffc5df615fae85557936 (diff)
downloadports-3271400a5e29ce317d8bf66d395c0a4f2a8c0874.tar.gz
ports-3271400a5e29ce317d8bf66d395c0a4f2a8c0874.zip
Mk/Uses/go.mk: fix gomod-clean target when lang/go is not installed
make distclean target will break when lang/go is not installed. This provides an informational feedback and skips the gomod-clean target if go executable is not available. PR: 258359 Submitted by: Rin Morningstar <ports.maintainer@evilphi.com> Reviewed by: dmgk Differential Revision: https://reviews.freebsd.org/D32054 (cherry picked from commit f76516f11076cb293ce87bccfc37797d82844063)
-rw-r--r--Mk/Uses/go.mk4
1 files changed, 4 insertions, 0 deletions
diff --git a/Mk/Uses/go.mk b/Mk/Uses/go.mk
index 81946128114a..32972c902342 100644
--- a/Mk/Uses/go.mk
+++ b/Mk/Uses/go.mk
@@ -215,8 +215,12 @@ do-test:
.if ${go_ARGS:Mmodules} && defined(GO_MODULE)
gomod-clean:
+.if exists(${GO_CMD})
@${ECHO_MSG} "===> Cleaning Go module cache"
@${SETENV} ${GO_ENV} ${GO_CMD} clean -modcache
+.else
+ @${ECHO_MSG} "===> Skipping since ${GO_CMD} is not installed"
+.endif
# Hook up to distclean
.if !target(post-clean) && !make(clean)