From 9f37935819949b5a577e7c0527bea50e9a2be43f Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Sun, 7 Aug 2022 20:39:05 +0300 Subject: [PATCH] Makefile: remove redundant `-mod=vendor` option when running Go tools The `-mod=vendor` is automatically set when there is a `vendor` directory starting from Go1.14 - see https://go.dev/doc/go1.14#go-command Since the minimum supported Go version for VictoriaMetrics is Go1.17, then the `-mod=vendor` option is no longer needed. --- Makefile | 30 +++++++++++++++--------------- deployment/docker/Makefile | 4 ++-- docs/CHANGELOG.md | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 04bb600c3..99d3ecf55 100644 --- a/Makefile +++ b/Makefile @@ -310,8 +310,8 @@ fmt: gofmt -l -w -s ./app vet: - go vet -mod=vendor ./lib/... - go vet -mod=vendor ./app/... + go vet ./lib/... + go vet ./app/... lint: install-golint golint lib/... @@ -338,27 +338,27 @@ install-errcheck: check-all: fmt vet lint errcheck golangci-lint test: - go test -mod=vendor ./lib/... ./app/... + go test ./lib/... ./app/... test-race: - go test -mod=vendor -race ./lib/... ./app/... + go test -race ./lib/... ./app/... test-pure: - CGO_ENABLED=0 go test -mod=vendor ./lib/... ./app/... + CGO_ENABLED=0 go test ./lib/... ./app/... test-full: - go test -mod=vendor -coverprofile=coverage.txt -covermode=atomic ./lib/... ./app/... + go test -coverprofile=coverage.txt -covermode=atomic ./lib/... ./app/... test-full-386: - GOARCH=386 go test -mod=vendor -coverprofile=coverage.txt -covermode=atomic ./lib/... ./app/... + GOARCH=386 go test -coverprofile=coverage.txt -covermode=atomic ./lib/... ./app/... benchmark: - go test -mod=vendor -bench=. ./lib/... - go test -mod=vendor -bench=. ./app/... + go test -bench=. ./lib/... + go test -bench=. ./app/... benchmark-pure: - CGO_ENABLED=0 go test -mod=vendor -bench=. ./lib/... - CGO_ENABLED=0 go test -mod=vendor -bench=. ./app/... + CGO_ENABLED=0 go test -bench=. ./lib/... + CGO_ENABLED=0 go test -bench=. ./app/... vendor-update: go get -u -d ./lib/... @@ -367,16 +367,16 @@ vendor-update: go mod vendor app-local: - CGO_ENABLED=1 go build $(RACE) -mod=vendor -ldflags "$(GO_BUILDINFO)" -o bin/$(APP_NAME)$(RACE) $(PKG_PREFIX)/app/$(APP_NAME) + CGO_ENABLED=1 go build $(RACE) -ldflags "$(GO_BUILDINFO)" -o bin/$(APP_NAME)$(RACE) $(PKG_PREFIX)/app/$(APP_NAME) app-local-pure: - CGO_ENABLED=0 go build $(RACE) -mod=vendor -ldflags "$(GO_BUILDINFO)" -o bin/$(APP_NAME)-pure$(RACE) $(PKG_PREFIX)/app/$(APP_NAME) + CGO_ENABLED=0 go build $(RACE) -ldflags "$(GO_BUILDINFO)" -o bin/$(APP_NAME)-pure$(RACE) $(PKG_PREFIX)/app/$(APP_NAME) app-local-goos-goarch: - CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) GOARCH=$(GOARCH) go build $(RACE) -mod=vendor -ldflags "$(GO_BUILDINFO)" -o bin/$(APP_NAME)-$(GOOS)-$(GOARCH)$(RACE) $(PKG_PREFIX)/app/$(APP_NAME) + CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) GOARCH=$(GOARCH) go build $(RACE) -ldflags "$(GO_BUILDINFO)" -o bin/$(APP_NAME)-$(GOOS)-$(GOARCH)$(RACE) $(PKG_PREFIX)/app/$(APP_NAME) app-local-windows-goarch: - CGO_ENABLED=0 GOOS=windows GOARCH=$(GOARCH) go build $(RACE) -mod=vendor -ldflags "$(GO_BUILDINFO)" -o bin/$(APP_NAME)-windows-$(GOARCH)$(RACE).exe $(PKG_PREFIX)/app/$(APP_NAME) + CGO_ENABLED=0 GOOS=windows GOARCH=$(GOARCH) go build $(RACE) -ldflags "$(GO_BUILDINFO)" -o bin/$(APP_NAME)-windows-$(GOARCH)$(RACE).exe $(PKG_PREFIX)/app/$(APP_NAME) quicktemplate-gen: install-qtc qtc diff --git a/deployment/docker/Makefile b/deployment/docker/Makefile index af4efea96..07a31dfda 100644 --- a/deployment/docker/Makefile +++ b/deployment/docker/Makefile @@ -36,7 +36,7 @@ app-via-docker: package-builder --env GOCACHE=/gocache \ $(DOCKER_OPTS) \ $(BUILDER_IMAGE) \ - go build $(RACE) -mod=vendor -trimpath -buildvcs=false \ + go build $(RACE) -trimpath -buildvcs=false \ -ldflags "-extldflags '-static' $(GO_BUILDINFO)" \ -tags 'netgo osusergo nethttpomithttp2 musl' \ -o bin/$(APP_NAME)$(APP_SUFFIX)-prod $(PKG_PREFIX)/app/$(APP_NAME) @@ -51,7 +51,7 @@ app-via-docker-windows: package-builder --env GOCACHE=/gocache \ $(DOCKER_OPTS) \ $(BUILDER_IMAGE) \ - go build $(RACE) -mod=vendor -trimpath -buildvcs=false \ + go build $(RACE) -trimpath -buildvcs=false \ -ldflags "-s -w -extldflags '-static' $(GO_BUILDINFO)" \ -tags 'netgo osusergo nethttpomithttp2' \ -o bin/$(APP_NAME)-windows$(APP_SUFFIX)-prod.exe $(PKG_PREFIX)/app/$(APP_NAME) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index af08a8619..e663c2619 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -943,7 +943,7 @@ Released at 02-03-2021 * FEATURE: vmagent: optimize [relabeling](https://docs.victoriametrics.com/vmagent.html#relabeling) performance for common cases. * FEATURE: add `increase_pure(m[d])` function to MetricsQL. It works the same as `increase(m[d])` except of various edge cases. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/962) for details. * FEATURE: increase accuracy for `buckets_limit(limit, buckets)` results for small `limit` values. See [MetricsQL docs](https://docs.victoriametrics.com/MetricsQL.html) for details. -* FEATURE: vmagent: initial support for Windows build with `CGO_ENABLED=0 GOOS=windows go build -mod=vendor ./app/vmagent`. See [this](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/70) and [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1036). +* FEATURE: vmagent: initial support for Windows build with `CGO_ENABLED=0 GOOS=windows go build ./app/vmagent`. See [this](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/70) and [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1036). * FEATURE: vmagent: support WebIdentityToken auth in EC2 service discovery. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1080) for details. * FEATURE: vmalert: properly process query params in `-datasource.url` and `-remoteRead.url` command-line flags. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1087) for details.