Skip to content

Commit 64fa54c

Browse files
committed
Merge tag 'v1.19.1'
* tag 'v1.19.1': Use separate go.mod/go.sum to manage tool deps. (golangci#736) Use stretchr/testify to mock log. Fix golangci#733: update forked bodyclose Cleanup obsolete go.mod/go.sum diff. (golangci#729) dev: update deprecated parts of .goreleaser.yml dev: trigger CI build on tag push Update minimum Go version to 1.12. Enable consistent GOPROXY Go 1.12/1.13 behavior. Fix golangci#608: use forked bodyclose Drop memory usage of go/analysis linters 5x Manage build tools via go.mod. Update whitespace Reduce memory usage of go/analysis
2 parents f8997e6 + c427c61 commit 64fa54c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+5800
-1644
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@
55
/.idea/
66
/test/path
77
/golangci-lint
8-
/tools/
8+
/tools/Dracula.itermcolors
9+
/tools/node_modules
10+
/tools/svg-term
911
/.vscode/

.golangci.example.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ linters-settings:
205205
# checks assignments with too many blank identifiers; default is 2
206206
max-blank-identifiers: 2
207207

208+
whitespace:
209+
multi-if: false
210+
208211
linters:
209212
enable:
210213
- megacheck

.goreleaser.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ builds:
2626
main: ./cmd/golangci-lint/
2727
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
2828

29-
archive:
30-
format: tar.gz
31-
wrap_in_directory: true
32-
format_overrides:
33-
- goos: windows
34-
format: zip
35-
name_template: '{{ .Binary }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
36-
files:
37-
- LICENSE
38-
- README.md
29+
archives:
30+
- format: tar.gz
31+
wrap_in_directory: true
32+
format_overrides:
33+
- goos: windows
34+
format: zip
35+
name_template: '{{ .Binary }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
36+
files:
37+
- LICENSE
38+
- README.md
3939

4040
snapshot:
4141
name_template: SNAPSHOT-{{ .Commit }}
@@ -60,17 +60,17 @@ dockers:
6060
- "golangci/golangci-lint:{{ .Tag }}"
6161
- "golangci/golangci-lint:v{{ .Major }}.{{ .Minor }}"
6262

63-
brew:
64-
github:
65-
owner: golangci
66-
name: homebrew-tap
67-
folder: Formula
68-
homepage: https://golangci.com
69-
description: Fast linters runner for Go.
70-
install: |
71-
bin.install "golangci-lint"
72-
output = Utils.popen_read("#{bin}/golangci-lint completion bash")
73-
(bash_completion/"golangci-lint").write output
74-
prefix.install_metafiles
75-
test: |
76-
system "#{bin}/golangci-lint --version"
63+
brews:
64+
- github:
65+
owner: golangci
66+
name: homebrew-tap
67+
folder: Formula
68+
homepage: https://golangci.com
69+
description: Fast linters runner for Go.
70+
install: |
71+
bin.install "golangci-lint"
72+
output = Utils.popen_read("#{bin}/golangci-lint completion bash")
73+
(bash_completion/"golangci-lint").write output
74+
prefix.install_metafiles
75+
test: |
76+
system "#{bin}/golangci-lint --version"

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ script:
1717
branches:
1818
only: # speed up CI: don't build pull requests twice
1919
- "master"
20+
- /^v\d+\.\d+\.\d+$/
2021

2122
after_success:
2223
- test -n "$TRAVIS_TAG" && docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
@@ -31,7 +32,7 @@ deploy:
3132
skip_cleanup: true
3233
script:
3334
- make test_race
34-
- curl -sL https://git.io/goreleaser | bash
35+
- make release
3536
on:
3637
tags: true
3738
# it's important to build on the newest version of go:

Makefile

Lines changed: 21 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
.DEFAULT_GOAL = test
22
.PHONY: FORCE
33

4-
# Enable Go module support across all commands.
4+
# enable module support across all go commands.
55
export GO111MODULE = on
6+
# opt-in to vendor deps across all go commands.
7+
export GOFLAGS = -mod=vendor
8+
# enable consistent Go 1.12/1.13 GOPROXY behavior.
9+
export GOPROXY = https://proxy.golang.org
610

711
# Build
812

@@ -12,8 +16,11 @@ build_race: FORCE
1216
go build -race -o golangci-lint ./cmd/golangci-lint
1317
build: golangci-lint
1418
clean:
15-
rm -f golangci-lint test/path
16-
rm -rf tools
19+
rm -f golangci-lint
20+
rm -f test/path
21+
rm -f tools/svg-term
22+
rm -f tools/Dracula.itermcolors
23+
rm -rf tools/node_modules
1724
.PHONY: fast_build build build_race clean
1825

1926
# Test
@@ -36,81 +43,58 @@ test_linters:
3643

3744
# Maintenance
3845

39-
generate: README.md docs/demo.svg install.sh pkg/logutils/mock_logutils/mock_log.go vendor
46+
generate: README.md docs/demo.svg install.sh vendor
4047
fast_generate: README.md vendor
4148

4249
maintainer-clean: clean
43-
rm -f docs/demo.svg README.md install.sh pkg/logutils/mock_logutils/mock_log.go
50+
rm -f docs/demo.svg README.md install.sh
4451
rm -rf vendor
4552
.PHONY: generate maintainer-clean
4653

4754
check_generated:
4855
$(MAKE) --always-make generate
49-
git checkout -- go.mod go.sum # can differ between go1.11 and go1.12
5056
git checkout -- vendor/modules.txt # can differ between go1.12 and go1.13
5157
git diff --exit-code # check no changes
5258
.PHONY: check_generated
5359

5460
fast_check_generated:
5561
$(MAKE) --always-make fast_generate
56-
git checkout -- go.mod go.sum # can differ between go1.11 and go1.12
5762
git checkout -- vendor/modules.txt # can differ between go1.12 and go1.13
5863
git diff --exit-code # check no changes
5964
.PHONY: fast_check_generated
6065

61-
release:
62-
rm -rf dist
63-
curl -sL https://git.io/goreleaser | bash
66+
release: export GOFLAGS = -mod=readonly
67+
release: .goreleaser.yml
68+
cd tools && go run github.com/goreleaser/goreleaser --config ../.goreleaser.yml
6469
.PHONY: release
6570

6671
# Non-PHONY targets (real files)
6772

68-
golangci-lint: FORCE pkg/logutils/mock_logutils/mock_log.go
73+
golangci-lint: FORCE
6974
go build -o $@ ./cmd/golangci-lint
7075

71-
tools/mockgen: go.mod go.sum
72-
GOBIN=$(CURDIR)/tools go install github.com/golang/mock/mockgen
73-
74-
tools/goimports: go.mod go.sum
75-
GOBIN=$(CURDIR)/tools go install golang.org/x/tools/cmd/goimports
76-
77-
tools/go.mod:
78-
@mkdir -p tools
79-
@rm -f $@
80-
cd tools && go mod init local-tools
81-
82-
tools/godownloader: Makefile tools/go.mod
83-
# https://github.com/goreleaser/godownloader/issues/133
84-
cd tools && GOBIN=$(CURDIR)/tools go get -u github.com/goreleaser/godownloader
85-
86-
tools/svg-term:
87-
@mkdir -p tools
76+
tools/svg-term: tools/package.json tools/package-lock.json
8877
cd tools && npm ci
8978
ln -sf node_modules/.bin/svg-term $@
9079

9180
tools/Dracula.itermcolors:
92-
@mkdir -p tools
9381
curl -fL -o $@ https://raw.githubusercontent.com/dracula/iterm/master/Dracula.itermcolors
9482

9583
docs/demo.svg: tools/svg-term tools/Dracula.itermcolors
96-
PATH=$(CURDIR)/tools:$${PATH} svg-term --cast=183662 --out docs/demo.svg --window --width 110 --height 30 --from 2000 --to 20000 --profile ./tools/Dracula.itermcolors --term iterm2
84+
./tools/svg-term --cast=183662 --out docs/demo.svg --window --width 110 --height 30 --from 2000 --to 20000 --profile ./tools/Dracula.itermcolors --term iterm2
9785

98-
install.sh: tools/godownloader .goreleaser.yml
99-
PATH=$(CURDIR)/tools:$${PATH} tools/godownloader .goreleaser.yml | sed '/DO NOT EDIT/s/ on [0-9TZ:-]*//' > $@
86+
install.sh: export GOFLAGS = -mod=readonly
87+
install.sh: .goreleaser.yml
88+
cd tools && go run github.com/goreleaser/godownloader ../.goreleaser.yml | sed '/DO NOT EDIT/s/ on [0-9TZ:-]*//' > ../$@
10089

10190
README.md: FORCE golangci-lint
10291
go run ./scripts/gen_readme/main.go
10392

104-
pkg/logutils/mock_logutils/mock_log.go: tools/mockgen tools/goimports pkg/logutils/log.go
105-
@rm -f $@
106-
PATH=$(CURDIR)/tools:$${PATH} go generate ./...
107-
10893
go.mod: FORCE
10994
go mod tidy
11095
go mod verify
11196
go.sum: go.mod
11297

11398
.PHONY: vendor
11499
vendor: go.mod go.sum
115-
rm -rf vendor
116100
go mod vendor

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ Local installation is not recommended for your CI pipeline. Only install the lin
8484
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
8585
```
8686

87-
With `go1.11` or later you can get a particular version
87+
With `go1.12` or later you can get a particular version
8888

8989
```bash
90-
GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.17.1
90+
GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.18.0
9191
```
9292

9393
#### MacOS
@@ -560,6 +560,7 @@ Global Flags:
560560
-j, --concurrency int Concurrency (default NumCPU) (default 8)
561561
--cpu-profile-path string Path to CPU profile output file
562562
--mem-profile-path string Path to memory profile output file
563+
--trace-path string Path to trace output file
563564
-v, --verbose verbose output
564565
565566
```
@@ -789,6 +790,9 @@ linters-settings:
789790
# checks assignments with too many blank identifiers; default is 2
790791
max-blank-identifiers: 2
791792
793+
whitespace:
794+
multi-if: false
795+
792796
linters:
793797
enable:
794798
- megacheck
@@ -1067,7 +1071,7 @@ Long answer:
10671071
2. go1.9 is officially supported by golangci-lint <= v1.10.2
10681072
3. go1.10 is officially supported by golangci-lint <= 1.15.0.
10691073
4. go1.11 is officially supported by golangci-lint <= 1.17.1.
1070-
5. go1.12 and go1.13 are officially supported by the latest version of golangci-lint (>= 1.18.0).
1074+
5. go1.12+ are officially supported by the latest version of golangci-lint (>= 1.18.0).
10711075
10721076
**`golangci-lint` doesn't work**
10731077

README.tmpl.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ Local installation is not recommended for your CI pipeline. Only install the lin
8484
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
8585
```
8686

87-
With `go1.11` or later you can get a particular version
87+
With `go1.12` or later you can get a particular version
8888

8989
```bash
90-
GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.17.1
90+
GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.18.0
9191
```
9292

9393
#### MacOS
@@ -535,7 +535,7 @@ Long answer:
535535
2. go1.9 is officially supported by golangci-lint <= v1.10.2
536536
3. go1.10 is officially supported by golangci-lint <= 1.15.0.
537537
4. go1.11 is officially supported by golangci-lint <= 1.17.1.
538-
5. go1.12 and go1.13 are officially supported by the latest version of golangci-lint (>= 1.18.0).
538+
5. go1.12+ are officially supported by the latest version of golangci-lint (>= 1.18.0).
539539

540540
**`golangci-lint` doesn't work**
541541

go.mod

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
module github.com/golangci/golangci-lint
22

3-
go 1.11
3+
go 1.12
44

55
require (
66
github.com/OpenPeeDeeP/depguard v1.0.1
77
github.com/fatih/color v1.7.0
88
github.com/go-critic/go-critic v0.3.5-0.20190904082202-d79a9f0c64db
99
github.com/go-lintpack/lintpack v0.5.2
10-
github.com/golang/mock v1.3.1
1110
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2
1211
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a
1312
github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6
@@ -37,7 +36,7 @@ require (
3736
github.com/stretchr/testify v1.4.0
3837
github.com/timakin/bodyclose v0.0.0-20190721030226-87058b9bfcec
3938
github.com/ultraware/funlen v0.0.2
40-
github.com/ultraware/whitespace v0.0.2
39+
github.com/ultraware/whitespace v0.0.3
4140
github.com/valyala/quicktemplate v1.2.0
4241
golang.org/x/tools v0.0.0-20190912215617-3720d1ec3678
4342
gopkg.in/yaml.v2 v2.2.2
@@ -47,7 +46,12 @@ require (
4746
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f
4847
)
4948

50-
// https://github.com/golang/tools/pull/162
51-
// https://github.com/golang/tools/pull/160
52-
// https://github.com/golang/tools/pull/156
53-
replace golang.org/x/tools => github.com/golangci/tools v0.0.0-20190915081525-6aa350649b1c
49+
replace (
50+
// https://github.com/timakin/bodyclose/pull/20
51+
github.com/timakin/bodyclose => github.com/golangci/bodyclose v0.0.0-20190924091105-43b3ff1b0de0
52+
53+
// https://github.com/golang/tools/pull/156
54+
// https://github.com/golang/tools/pull/160
55+
// https://github.com/golang/tools/pull/162
56+
golang.org/x/tools => github.com/golangci/tools v0.0.0-20190915081525-6aa350649b1c
57+
)

go.sum

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zV
7070
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
7171
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
7272
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
73-
github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s=
74-
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
7573
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
7674
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
7775
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
7876
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
77+
github.com/golangci/bodyclose v0.0.0-20190924091105-43b3ff1b0de0 h1:SOIRs5twdFsHlEhPmysNtHiveNIMdXcwUZgvN+tKFWc=
78+
github.com/golangci/bodyclose v0.0.0-20190924091105-43b3ff1b0de0/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk=
7979
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0=
8080
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4=
8181
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM=
@@ -221,20 +221,19 @@ github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU=
221221
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
222222
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
223223
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
224+
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
224225
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
225226
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
226227
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
227228
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
228229
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
229-
github.com/timakin/bodyclose v0.0.0-20190721030226-87058b9bfcec h1:AmoEvWAO3nDx1MEcMzPh+GzOOIA5Znpv6++c7bePPY0=
230-
github.com/timakin/bodyclose v0.0.0-20190721030226-87058b9bfcec/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk=
231230
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
232231
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
233232
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
234233
github.com/ultraware/funlen v0.0.2 h1:Av96YVBwwNSe4MLR7iI/BIa3VyI7/djnto/pK3Uxbdo=
235234
github.com/ultraware/funlen v0.0.2/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA=
236-
github.com/ultraware/whitespace v0.0.2 h1:iL4Un0C3VaMIBGfDogtcdBeSotjfSHYW8OdI1U9Vqas=
237-
github.com/ultraware/whitespace v0.0.2/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA=
235+
github.com/ultraware/whitespace v0.0.3 h1:S5BCRRB5sttNy0bSOhbpw+0mb+cHiCmWfrvxpEzuUk0=
236+
github.com/ultraware/whitespace v0.0.3/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA=
238237
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
239238
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
240239
github.com/valyala/fasthttp v1.2.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk8LWSxF3s=

0 commit comments

Comments
 (0)