Skip to content

Commit f8b636f

Browse files
authored
Merge pull request #576 from prometheus/repo_sync
Synchronize common files from prometheus/prometheus
2 parents 5070cf3 + 7cfb0ed commit f8b636f

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

.github/workflows/golangci-lint.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
paths:
5+
- "go.sum"
6+
- "go.mod"
7+
- "**.go"
8+
- "scripts/errcheck_excludes.txt"
9+
- ".github/workflows/golangci-lint.yml"
10+
pull_request:
11+
paths:
12+
- "go.sum"
13+
- "go.mod"
14+
- "**.go"
15+
- "scripts/errcheck_excludes.txt"
16+
- ".github/workflows/golangci-lint.yml"
17+
18+
jobs:
19+
golangci:
20+
name: lint
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v2
25+
26+
- name: Lint
27+
uses: golangci/golangci-lint-action@v2
28+
with:
29+
version: v1.42.0

Makefile.common

+8-2
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,18 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
8383

8484
GOLANGCI_LINT :=
8585
GOLANGCI_LINT_OPTS ?=
86-
GOLANGCI_LINT_VERSION ?= v1.39.0
86+
GOLANGCI_LINT_VERSION ?= v1.42.0
8787
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
8888
# windows isn't included here because of the path separator being different.
8989
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
9090
ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386))
91-
GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
91+
# If we're in CI and there is an Actions file, that means the linter
92+
# is being run in Actions, so we don't need to run it here.
93+
ifeq (,$(CIRCLE_JOB))
94+
GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
95+
else ifeq (,$(wildcard .github/workflows/golangci-lint.yml))
96+
GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
97+
endif
9298
endif
9399
endif
94100

0 commit comments

Comments
 (0)