diff --git a/Mk/Uses/go.mk b/Mk/Uses/go.mk --- a/Mk/Uses/go.mk +++ b/Mk/Uses/go.mk @@ -215,8 +215,12 @@ .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)