From b70fb40c11eaee21a38f37ebc9b29edb486c4d93 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 16 Oct 2020 17:13:42 +0800 Subject: [PATCH 1/2] golang: Move build cache into $(TMP_DIR) This changes the default build cache directory from $(TOPDIR)/.go-build to $(TMP_DIR)/go-build, so that the cache directory is ignored by git and is removed by "make dirclean". This does not move/remove a build cache directory in the previous location; it will need to be removed manually. Fixes https://github.com/openwrt/packages/issues/13675. Signed-off-by: Jeffery To --- lang/golang/golang-values.mk | 2 +- lang/golang/golang/Config.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lang/golang/golang-values.mk b/lang/golang/golang-values.mk index 69126a1ed..b029ba5b1 100644 --- a/lang/golang/golang-values.mk +++ b/lang/golang/golang-values.mk @@ -236,7 +236,7 @@ endif # General build info -GO_BUILD_CACHE_DIR:=$(or $(call qstrip,$(CONFIG_GOLANG_BUILD_CACHE_DIR)),$(TOPDIR)/.go-build) +GO_BUILD_CACHE_DIR:=$(or $(call qstrip,$(CONFIG_GOLANG_BUILD_CACHE_DIR)),$(TMP_DIR)/go-build) GO_MOD_CACHE_DIR:=$(DL_DIR)/go-mod-cache GO_MOD_ARGS= \ diff --git a/lang/golang/golang/Config.in b/lang/golang/golang/Config.in index 714bf01fd..76fd85c80 100644 --- a/lang/golang/golang/Config.in +++ b/lang/golang/golang/Config.in @@ -17,7 +17,7 @@ config GOLANG_BUILD_CACHE_DIR default "" help Store the Go build cache in this directory. - If not set, uses './.go-build'. + If not set, uses '$(TMP_DIR)/go-build'. config GOLANG_MOD_CACHE_WORLD_READABLE bool "Ensure Go module cache is world-readable" From 0a4d40b37eb71c098c360cd0b8d35fcd39d4a7ee Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 16 Oct 2020 17:38:17 +0800 Subject: [PATCH 2/2] golang: Fix vars not passed when calling cache_cleanup Fixes https://github.com/openwrt/packages/issues/13674. Signed-off-by: Jeffery To --- lang/golang/golang-values.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/golang/golang-values.mk b/lang/golang/golang-values.mk index b029ba5b1..657afe2d7 100644 --- a/lang/golang/golang-values.mk +++ b/lang/golang/golang-values.mk @@ -249,6 +249,6 @@ GO_GENERAL_BUILD_CONFIG_VARS= \ GO_MOD_ARGS="$(GO_MOD_ARGS)" define Go/CacheCleanup - $(GENERAL_BUILD_CONFIG_VARS) \ + $(GO_GENERAL_BUILD_CONFIG_VARS) \ $(SHELL) $(GO_INCLUDE_DIR)/golang-build.sh cache_cleanup endef