Skip to content

Commit d609150

Browse files
authored
Merge pull request #48 from prometheus-community/repo_sync
Synchronize common files from prometheus/prometheus
2 parents d5ae2a8 + 1973fae commit d609150

File tree

3 files changed

+21
-71
lines changed

3 files changed

+21
-71
lines changed

CODE_OF_CONDUCT.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
## Prometheus Community Code of Conduct
1+
# Prometheus Community Code of Conduct
22

3-
Prometheus follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
3+
Prometheus follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md).

Makefile.common

+18-68
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,6 @@ GO_VERSION ?= $(shell $(GO) version)
3636
GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION))
3737
PRE_GO_111 ?= $(shell echo $(GO_VERSION_NUMBER) | grep -E 'go1\.(10|[0-9])\.')
3838

39-
GOVENDOR :=
40-
GO111MODULE :=
41-
ifeq (, $(PRE_GO_111))
42-
ifneq (,$(wildcard go.mod))
43-
# Enforce Go modules support just in case the directory is inside GOPATH (and for Travis CI).
44-
GO111MODULE := on
45-
46-
ifneq (,$(wildcard vendor))
47-
# Always use the local vendor/ directory to satisfy the dependencies.
48-
GOOPTS := $(GOOPTS) -mod=vendor
49-
endif
50-
endif
51-
else
52-
ifneq (,$(wildcard go.mod))
53-
ifneq (,$(wildcard vendor))
54-
$(warning This repository requires Go >= 1.11 because of Go modules)
55-
$(warning Some recipes may not work as expected as the current Go runtime is '$(GO_VERSION_NUMBER)')
56-
endif
57-
else
58-
# This repository isn't using Go modules (yet).
59-
GOVENDOR := $(FIRST_GOPATH)/bin/govendor
60-
endif
61-
endif
6239
PROMU := $(FIRST_GOPATH)/bin/promu
6340
pkgs = ./...
6441

@@ -78,19 +55,22 @@ ifneq ($(shell which gotestsum),)
7855
endif
7956
endif
8057

81-
PROMU_VERSION ?= 0.12.0
58+
PROMU_VERSION ?= 0.13.0
8259
PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz
8360

61+
SKIP_GOLANGCI_LINT :=
8462
GOLANGCI_LINT :=
8563
GOLANGCI_LINT_OPTS ?=
86-
GOLANGCI_LINT_VERSION ?= v1.42.0
64+
GOLANGCI_LINT_VERSION ?= v1.49.0
8765
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
8866
# windows isn't included here because of the path separator being different.
8967
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
9068
ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386))
9169
# If we're in CI and there is an Actions file, that means the linter
9270
# is being run in Actions, so we don't need to run it here.
93-
ifeq (,$(CIRCLE_JOB))
71+
ifneq (,$(SKIP_GOLANGCI_LINT))
72+
GOLANGCI_LINT :=
73+
else ifeq (,$(CIRCLE_JOB))
9474
GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
9575
else ifeq (,$(wildcard .github/workflows/golangci-lint.yml))
9676
GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
@@ -150,58 +130,47 @@ common-check_license:
150130
.PHONY: common-deps
151131
common-deps:
152132
@echo ">> getting dependencies"
153-
ifdef GO111MODULE
154-
GO111MODULE=$(GO111MODULE) $(GO) mod download
155-
else
156-
$(GO) get $(GOOPTS) -t ./...
157-
endif
133+
$(GO) mod download
158134

159135
.PHONY: update-go-deps
160136
update-go-deps:
161137
@echo ">> updating Go dependencies"
162138
@for m in $$($(GO) list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \
163-
$(GO) get $$m; \
139+
$(GO) get -d $$m; \
164140
done
165-
GO111MODULE=$(GO111MODULE) $(GO) mod tidy
166-
ifneq (,$(wildcard vendor))
167-
GO111MODULE=$(GO111MODULE) $(GO) mod vendor
168-
endif
141+
$(GO) mod tidy
169142

170143
.PHONY: common-test-short
171144
common-test-short: $(GOTEST_DIR)
172145
@echo ">> running short tests"
173-
GO111MODULE=$(GO111MODULE) $(GOTEST) -short $(GOOPTS) $(pkgs)
146+
$(GOTEST) -short $(GOOPTS) $(pkgs)
174147

175148
.PHONY: common-test
176149
common-test: $(GOTEST_DIR)
177150
@echo ">> running all tests"
178-
GO111MODULE=$(GO111MODULE) $(GOTEST) $(test-flags) $(GOOPTS) $(pkgs)
151+
$(GOTEST) $(test-flags) $(GOOPTS) $(pkgs)
179152

180153
$(GOTEST_DIR):
181154
@mkdir -p $@
182155

183156
.PHONY: common-format
184157
common-format:
185158
@echo ">> formatting code"
186-
GO111MODULE=$(GO111MODULE) $(GO) fmt $(pkgs)
159+
$(GO) fmt $(pkgs)
187160

188161
.PHONY: common-vet
189162
common-vet:
190163
@echo ">> vetting code"
191-
GO111MODULE=$(GO111MODULE) $(GO) vet $(GOOPTS) $(pkgs)
164+
$(GO) vet $(GOOPTS) $(pkgs)
192165

193166
.PHONY: common-lint
194167
common-lint: $(GOLANGCI_LINT)
195168
ifdef GOLANGCI_LINT
196169
@echo ">> running golangci-lint"
197-
ifdef GO111MODULE
198170
# 'go list' needs to be executed before staticcheck to prepopulate the modules cache.
199171
# Otherwise staticcheck might fail randomly for some reason not yet explained.
200-
GO111MODULE=$(GO111MODULE) $(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
201-
GO111MODULE=$(GO111MODULE) $(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs)
202-
else
203-
$(GOLANGCI_LINT) run $(pkgs)
204-
endif
172+
$(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
173+
$(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs)
205174
endif
206175

207176
.PHONY: common-yamllint
@@ -218,28 +187,15 @@ endif
218187
common-staticcheck: lint
219188

220189
.PHONY: common-unused
221-
common-unused: $(GOVENDOR)
222-
ifdef GOVENDOR
223-
@echo ">> running check for unused packages"
224-
@$(GOVENDOR) list +unused | grep . && exit 1 || echo 'No unused packages'
225-
else
226-
ifdef GO111MODULE
190+
common-unused:
227191
@echo ">> running check for unused/missing packages in go.mod"
228-
GO111MODULE=$(GO111MODULE) $(GO) mod tidy
229-
ifeq (,$(wildcard vendor))
192+
$(GO) mod tidy
230193
@git diff --exit-code -- go.sum go.mod
231-
else
232-
@echo ">> running check for unused packages in vendor/"
233-
GO111MODULE=$(GO111MODULE) $(GO) mod vendor
234-
@git diff --exit-code -- go.sum go.mod vendor/
235-
endif
236-
endif
237-
endif
238194

239195
.PHONY: common-build
240196
common-build: promu
241197
@echo ">> building binaries"
242-
GO111MODULE=$(GO111MODULE) $(PROMU) build --prefix $(PREFIX) $(PROMU_BINARIES)
198+
$(PROMU) build --prefix $(PREFIX) $(PROMU_BINARIES)
243199

244200
.PHONY: common-tarball
245201
common-tarball: promu
@@ -295,12 +251,6 @@ $(GOLANGCI_LINT):
295251
| sh -s -- -b $(FIRST_GOPATH)/bin $(GOLANGCI_LINT_VERSION)
296252
endif
297253

298-
ifdef GOVENDOR
299-
.PHONY: $(GOVENDOR)
300-
$(GOVENDOR):
301-
GOOS= GOARCH= $(GO) get -u github.com/kardianos/govendor
302-
endif
303-
304254
.PHONY: precheck
305255
precheck::
306256

SECURITY.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
The Prometheus security policy, including how to report vulnerabilities, can be
44
found here:
55

6-
https://prometheus.io/docs/operating/security/
6+
<https://prometheus.io/docs/operating/security/>

0 commit comments

Comments
 (0)