From 225f239a69299d85ba7c2e48f9a6953ccb1e76b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Wed, 5 Apr 2023 19:50:40 +0200 Subject: [PATCH] Remove no-longer-necessary module options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We now require Go 1.18. As of that version: - GO111MODULE=on is implied by having a go.mod file - -mod=vendor is implied by having a vendor directory so just remove both options everywhere Signed-off-by: Miloslav Trmač --- Makefile | 13 +++---------- hack/make.sh | 13 ++----------- hack/make/validate-vet | 2 +- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index e7fea1a8..d6264b81 100644 --- a/Makefile +++ b/Makefile @@ -38,13 +38,6 @@ endif export CONTAINER_RUNTIME ?= $(if $(shell command -v podman ;),podman,docker) GOMD2MAN ?= $(if $(shell command -v go-md2man ;),go-md2man,$(GOBIN)/go-md2man) -# Go module support: set `-mod=vendor` to use the vendored sources. -# See also hack/make.sh. -ifeq ($(shell go help mod >/dev/null 2>&1 && echo true), true) - GO:=GO111MODULE=on $(GO) - MOD_VENDOR=-mod=vendor -endif - ifeq ($(DEBUG), 1) override GOGCFLAGS += -N -l endif @@ -133,9 +126,9 @@ binary: cmd/skopeo # Build w/o using containers .PHONY: bin/skopeo bin/skopeo: - $(GO) build $(MOD_VENDOR) ${GO_DYN_FLAGS} ${SKOPEO_LDFLAGS} -gcflags "$(GOGCFLAGS)" -tags "$(BUILDTAGS)" -o $@ ./cmd/skopeo + $(GO) build ${GO_DYN_FLAGS} ${SKOPEO_LDFLAGS} -gcflags "$(GOGCFLAGS)" -tags "$(BUILDTAGS)" -o $@ ./cmd/skopeo bin/skopeo.%: - GOOS=$(word 2,$(subst ., ,$@)) GOARCH=$(word 3,$(subst ., ,$@)) $(GO) build $(MOD_VENDOR) ${SKOPEO_LDFLAGS} -tags "containers_image_openpgp $(BUILDTAGS)" -o $@ ./cmd/skopeo + GOOS=$(word 2,$(subst ., ,$@)) GOARCH=$(word 3,$(subst ., ,$@)) $(GO) build ${SKOPEO_LDFLAGS} -tags "containers_image_openpgp $(BUILDTAGS)" -o $@ ./cmd/skopeo local-cross: bin/skopeo.darwin.amd64 bin/skopeo.linux.arm bin/skopeo.linux.arm64 bin/skopeo.windows.386.exe bin/skopeo.windows.amd64.exe $(MANPAGES): %: %.md @@ -239,7 +232,7 @@ validate-docs: bin/skopeo hack/xref-helpmsgs-manpages test-unit-local: - $(GO) test $(MOD_VENDOR) -tags "$(BUILDTAGS)" $$($(GO) list $(MOD_VENDOR) -tags "$(BUILDTAGS)" -e ./... | grep -v '^github\.com/containers/skopeo/\(integration\|vendor/.*\)$$') + $(GO) test -tags "$(BUILDTAGS)" $$($(GO) list -tags "$(BUILDTAGS)" -e ./... | grep -v '^github\.com/containers/skopeo/\(integration\|vendor/.*\)$$') vendor: $(GO) mod tidy diff --git a/hack/make.sh b/hack/make.sh index 83ed2ffc..7046810b 100755 --- a/hack/make.sh +++ b/hack/make.sh @@ -38,21 +38,12 @@ fi echo - -# Go module support: set `-mod=vendor` to use the vendored sources -# See also the top-level Makefile. -mod_vendor= -if go help mod >/dev/null 2>&1; then - export GO111MODULE=on - mod_vendor='-mod=vendor' -fi - go_test_dir() { dir=$1 ( - echo '+ go test' $mod_vendor $TESTFLAGS ${BUILDTAGS:+-tags "$BUILDTAGS"} "${SKOPEO_PKG}${dir#.}" + echo '+ go test' $TESTFLAGS ${BUILDTAGS:+-tags "$BUILDTAGS"} "${SKOPEO_PKG}${dir#.}" cd "$dir" - go test $mod_vendor $TESTFLAGS ${BUILDTAGS:+-tags "$BUILDTAGS"} + go test $TESTFLAGS ${BUILDTAGS:+-tags "$BUILDTAGS"} ) } diff --git a/hack/make/validate-vet b/hack/make/validate-vet index 17e5980c..6a66cd68 100755 --- a/hack/make/validate-vet +++ b/hack/make/validate-vet @@ -1,6 +1,6 @@ #!/bin/bash -errors=$(go vet -tags="${BUILDTAGS}" $mod_vendor $(go list $mod_vendor -e ./...)) +errors=$(go vet -tags="${BUILDTAGS}" $(go list -e ./...)) if [ -z "$errors" ]; then echo 'Congratulations! All Go source files have been vetted.'