From 07f8684e69e967cce8dc64dbe9c484f812ea0a8f Mon Sep 17 00:00:00 2001 From: dmgk Date: Mon, 2 Mar 2020 13:58:40 +0000 Subject: [PATCH] Mk/Uses/go.mk: Avoid pollution of Go module cache with modules downloaded by gomod-vendor Use module cache local to the WRKDIR and add the -modcacherw flag (available in go1.14 [1, 2]) to instruct go mod vendor to leave directories in the module cache read-write instead of making them unwritable. [1] https://github.com/golang/go/issues/31481 [2] https://go-review.googlesource.com/c/go/+/202079/ Reviewed by: swills Differential Revision: https://reviews.freebsd.org/D23063 --- Mk/Uses/go.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mk/Uses/go.mk b/Mk/Uses/go.mk index ed2a97e4765b9..59c03d880dd7e 100644 --- a/Mk/Uses/go.mk +++ b/Mk/Uses/go.mk @@ -179,7 +179,7 @@ _MODULES2TUPLE_CMD= modules2tuple gomod-vendor: patch @if type ${GO_CMD} > /dev/null 2>&1; then \ if type ${_MODULES2TUPLE_CMD} > /dev/null 2>&1; then \ - cd ${WRKSRC}; ${GO_CMD} mod vendor; \ + cd ${WRKSRC}; ${SETENV} GOPATH=${WRKDIR}/.gopath GOFLAGS=-modcacherw ${GO_CMD} mod vendor; \ [ -r vendor/modules.txt ] && ${_MODULES2TUPLE_CMD} vendor/modules.txt; \ else \ ${ECHO_MSG} "===> Please install \"ports-mgmt/modules2tuple\""; \