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
MFH:		2021Q4
Submitted by:	Rin Morningstar <ports.maintainer@evilphi.com>
Reviewed by:	dmgk
Differential Revision:	https://reviews.freebsd.org/D32054
This commit is contained in:
Guangyuan Yang 2021-11-06 21:26:02 -04:00
parent 86536a8e65
commit f76516f110

View File

@ -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)