Skip to content

Commit

Permalink
Makefile: set GOTOOLCHAIN=local
Browse files Browse the repository at this point in the history
Set GOTOOLCHAIN=local for all make targets, and for renovate.

Have the "vendor" target (and by extension, "vendor-in-container", which
our validation in CI uses) clear any "toolchain" directive that might
have been added to go.mod through manual invocations of the compiler.

At this point, we probably don't need to be checking for Go module
support, so switch to assuming it's available.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
  • Loading branch information
nalind committed May 2, 2024
1 parent 2227a81 commit a52f7e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,7 @@
"**/tests/**"
],

"env": {
"GOTOOLCHAIN": "local"
}
}
14 changes: 5 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export GOPROXY=https://proxy.golang.org
export GOTOOLCHAIN=local

APPARMORTAG := $(shell hack/apparmor_tag.sh)
STORAGETAGS := exclude_graphdriver_devicemapper $(shell ./btrfs_tag.sh) $(shell ./btrfs_installed_tag.sh) $(shell ./hack/libsubid_tag.sh)
Expand All @@ -22,14 +23,8 @@ STRIP ?= strip
GO := go
GO_LDFLAGS := $(shell if $(GO) version|grep -q gccgo; then echo "-gccgoflags"; else echo "-ldflags"; fi)
GO_GCFLAGS := $(shell if $(GO) version|grep -q gccgo; then echo "-gccgoflags"; else echo "-gcflags"; fi)
# test for go module support
ifeq ($(shell $(GO) help mod >/dev/null 2>&1 && echo true), true)
export GO_BUILD=GO111MODULE=on $(GO) build -mod=vendor
export GO_TEST=GO111MODULE=on $(GO) test -mod=vendor
else
export GO_BUILD=$(GO) build
export GO_TEST=$(GO) test
endif
RACEFLAGS := $(shell $(GO_TEST) -race ./pkg/dummy > /dev/null 2>&1 && echo -race)

COMMIT_NO ?= $(shell git rev-parse HEAD 2> /dev/null || true)
Expand Down Expand Up @@ -209,9 +204,10 @@ vendor-in-container:

.PHONY: vendor
vendor:
GO111MODULE=on $(GO) mod tidy
GO111MODULE=on $(GO) mod vendor
GO111MODULE=on $(GO) mod verify
$(GO) mod tidy
$(GO) mod vendor
$(GO) mod verify
if test -n "$(strip $(shell go env GOTOOLCHAIN))"; then go mod edit -toolchain none ; fi

.PHONY: lint
lint: install.tools
Expand Down

0 comments on commit a52f7e3

Please sign in to comment.