Skip to content

Commit dc152d3

Browse files
committed
Support go1.13
Setup Travis CI to run on go 1.12 and 1.13. Update info about go versions in README. Rebuild go.mod,go.sum on go1.13.
1 parent a8f2c27 commit dc152d3

Some content is hidden

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

49 files changed

+192
-6781
lines changed

.golangci.example.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ linters-settings:
123123
list-type: blacklist
124124
include-go-root: false
125125
packages:
126-
- github.com/davecgh/go-spew/spew
126+
- github.com/sirupsen/logrus
127+
packages-with-error-messages:
128+
# specify an error message to output when a blacklisted package is used
129+
github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
127130
misspell:
128131
# Correct spellings using locale preferences for US or UK.
129132
# Default is to use a neutral variety of English.

.golangci.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,16 @@ linters-settings:
4141
disabled-checks:
4242
- wrapperFunc
4343
- dupImport # https://github.com/go-critic/go-critic/issues/845
44-
funlen:
45-
lines: 70
4644

4745
linters:
4846
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
4947
disable-all: true
5048
enable:
5149
- bodyclose
5250
- deadcode
53-
- depguard
5451
- dupl
5552
- errcheck
56-
- funlen
53+
# - funlen - TODO: enable it when golangci.com will support it.
5754
- gochecknoinits
5855
- goconst
5956
- gocritic
@@ -79,6 +76,11 @@ linters:
7976
- unused
8077
- varcheck
8178

79+
# don't enable:
80+
# - depguard - until https://github.com/OpenPeeDeeP/depguard/issues/7 gets fixed
81+
# - maligned,prealloc
82+
# - gochecknoglobals
83+
8284
run:
8385
skip-dirs:
8486
- test/testdata_etc

.travis.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
language: go
22
go:
3-
- 1.11.x
43
- 1.12.x
4+
- 1.13.x
55

66
env:
77
global:
88
- NODE_VERSION=10.15.0
99

1010
before_script:
11-
- go get github.com/valyala/quicktemplate # for tests
12-
- go get github.com/pkg/errors # for tests
11+
# use GO111MODULE=off otherwise libs can't be updates inside vendor/
12+
- GO111MODULE=off go get github.com/valyala/quicktemplate # for tests
13+
- GO111MODULE=off go get github.com/pkg/errors # for tests
1314
- nvm install "${NODE_VERSION}"
1415

15-
script: make check_generated test
16+
script:
17+
- time make fast_check_generated
18+
- time make test
1619

1720
branches:
1821
only: # speed up CI: don't build pull requests twice

Makefile

+23-8
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ clean:
1111

1212
# Test
1313

14+
# until https://github.com/OpenPeeDeeP/depguard/issues/7 fixed
15+
test: export GO111MODULE = off
16+
test: export GOLANGCI_LINT_INSTALLED = true
17+
1418
test: build
15-
GL_TEST_RUN=1 ./golangci-lint run -v
16-
GL_TEST_RUN=1 ./golangci-lint run --fast --no-config -v --skip-dirs 'test/testdata_etc,pkg/golinters/goanalysis/(checker|passes)'
17-
GL_TEST_RUN=1 ./golangci-lint run --no-config -v --skip-dirs 'test/testdata_etc,pkg/golinters/goanalysis/(checker|passes)'
18-
GL_TEST_RUN=1 go test -v ./...
19+
GL_TEST_RUN=1 time ./golangci-lint run -v
20+
GL_TEST_RUN=1 time ./golangci-lint run --fast --no-config -v --skip-dirs 'test/testdata_etc,pkg/golinters/goanalysis/(checker|passes)'
21+
GL_TEST_RUN=1 time ./golangci-lint run --no-config -v --skip-dirs 'test/testdata_etc,pkg/golinters/goanalysis/(checker|passes)'
22+
GL_TEST_RUN=1 time go test -v ./...
1923

2024
.PHONY: test
2125

@@ -30,8 +34,9 @@ test_linters:
3034

3135
# Maintenance
3236

33-
generate: README.md install.sh pkg/logutils/log_mock.go vendor
34-
generate_svg: docs/demo.svg
37+
generate: README.md docs/demo.svg install.sh pkg/logutils/log_mock.go vendor
38+
fast_generate: README.md vendor
39+
3540
maintainer-clean: clean
3641
rm -f docs/demo.svg README.md install.sh pkg/logutils/log_mock.go
3742
rm -rf vendor
@@ -40,9 +45,17 @@ maintainer-clean: clean
4045
check_generated:
4146
$(MAKE) --always-make generate
4247
git checkout -- go.mod go.sum # can differ between go1.11 and go1.12
48+
git checkout -- vendor/modules.txt # can differ between go1.12 and go1.13
4349
git diff --exit-code # check no changes
4450
.PHONY: check_generated
4551

52+
fast_check_generated:
53+
$(MAKE) --always-make fast_generate
54+
git checkout -- go.mod go.sum # can differ between go1.11 and go1.12
55+
git checkout -- vendor/modules.txt # can differ between go1.12 and go1.13
56+
git diff --exit-code # check no changes
57+
.PHONY: fast_check_generated
58+
4659
release:
4760
rm -rf dist
4861
curl -sL https://git.io/goreleaser | bash
@@ -65,7 +78,8 @@ tools/go.mod:
6578
cd tools && GO111MODULE=on go mod init local-tools
6679

6780
tools/godownloader: Makefile tools/go.mod
68-
cd tools && GOBIN=$(CURDIR)/tools GO111MODULE=on go get github.com/goreleaser/godownloader@3b90d248ba30307915288f08ab3f2fc2d9f6710c
81+
# https://github.com/goreleaser/godownloader/issues/133
82+
cd tools && GOBIN=$(CURDIR)/tools GO111MODULE=off go get github.com/goreleaser/godownloader
6983

7084
tools/svg-term:
7185
@mkdir -p tools
@@ -79,7 +93,8 @@ tools/Dracula.itermcolors:
7993
docs/demo.svg: tools/svg-term tools/Dracula.itermcolors
8094
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
8195

82-
install.sh: tools/godownloader .goreleaser.yml
96+
install.sh:
97+
# dependencies: tools/godownloader .goreleaser.yml
8398
# TODO: use when Windows installation will be fixed in the upstream
8499
#PATH=$(CURDIR)/tools:$${PATH} tools/godownloader .goreleaser.yml | sed '/DO NOT EDIT/s/ on [0-9TZ:-]*//' > $@
85100

README.md

+23-15
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ use `--enable-all` and a new linter is added or even without `--enable-all`: whe
5252
It's highly recommended to install a fixed version of golangci-lint.
5353
Releases are available on the [releases page](https://github.com/golangci/golangci-lint/releases).
5454

55-
The recommended way to install golangci-lint (replace `vX.Y.Z` with the latest
56-
version from the [releases page](https://github.com/golangci/golangci-lint/releases)):
55+
Latest version: ![GitHub release](https://img.shields.io/github/release/golangci/golangci-lint.svg)
56+
57+
Here is the recommended way to install golangci-lint (replace `vX.Y.Z` with the latest version):
5758

5859
```bash
5960
# binary will be $(go env GOPATH)/bin/golangci-lint
@@ -676,7 +677,10 @@ linters-settings:
676677
list-type: blacklist
677678
include-go-root: false
678679
packages:
679-
- github.com/davecgh/go-spew/spew
680+
- github.com/sirupsen/logrus
681+
packages-with-error-messages:
682+
# specify an error message to output when a blacklisted package is used
683+
github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
680684
misspell:
681685
# Correct spellings using locale preferences for US or UK.
682686
# Default is to use a neutral variety of English.
@@ -861,19 +865,16 @@ linters-settings:
861865
disabled-checks:
862866
- wrapperFunc
863867
- dupImport # https://github.com/go-critic/go-critic/issues/845
864-
funlen:
865-
lines: 70
866868
867869
linters:
868870
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
869871
disable-all: true
870872
enable:
871873
- bodyclose
872874
- deadcode
873-
- depguard
874875
- dupl
875876
- errcheck
876-
- funlen
877+
# - funlen - TODO: enable it when golangci.com will support it.
877878
- gochecknoinits
878879
- goconst
879880
- gocritic
@@ -899,6 +900,11 @@ linters:
899900
- unused
900901
- varcheck
901902
903+
# don't enable:
904+
# - depguard - until https://github.com/OpenPeeDeeP/depguard/issues/7 gets fixed
905+
# - maligned,prealloc
906+
# - gochecknoglobals
907+
902908
run:
903909
skip-dirs:
904910
- test/testdata_etc
@@ -947,13 +953,13 @@ To exclude issues for the block of code use this directive on the beginning of a
947953
```go
948954
//nolint
949955
func allIssuesInThisFunctionAreExcluded() *string {
950-
// ...
956+
// ...
951957
}
952958
953959
//nolint:govet
954960
var (
955-
a int
956-
b int
961+
a int
962+
b int
957963
)
958964
```
959965
@@ -969,7 +975,7 @@ You may add a comment explaining or justifying why `//nolint` is being used on t
969975
```go
970976
//nolint:gocyclo // This legacy function is complex but the team too busy to simplify it
971977
func someLegacyFunction() *string {
972-
// ...
978+
// ...
973979
}
974980
```
975981
@@ -1002,13 +1008,15 @@ We don't recommend vendoring `golangci-lint` in your repo: you will get troubles
10021008
No, you don't need to do it anymore.
10031009
10041010
**Which go versions are supported**
1005-
Short answer: go 1.11 and newer are oficially supported.
1011+
Short answer: go 1.12 and newer are oficially supported.
10061012
10071013
Long answer:
1014+
10081015
1. go < 1.9 isn't supported
1009-
2. go 1.9 is supported by golangci-lint <= v1.10.2
1010-
3. go 1.10 is officially supported by golangci-lint <= 1.15.0.
1011-
4. go1.11 and go1.12 are officially supported by the latest version of golangci-lint.
1016+
2. go1.9 is officially supported by golangci-lint <= v1.10.2
1017+
3. go1.10 is officially supported by golangci-lint <= 1.15.0.
1018+
4. go1.11 is officially supported by golangci-lint <= 1.17.1.
1019+
5. go1.12 and go1.13 are officially supported by the latest version of golangci-lint (>= 1.18.0).
10121020
10131021
**`golangci-lint` doesn't work**
10141022

README.tmpl.md

+13-10
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ use `--enable-all` and a new linter is added or even without `--enable-all`: whe
5252
It's highly recommended to install a fixed version of golangci-lint.
5353
Releases are available on the [releases page](https://github.com/golangci/golangci-lint/releases).
5454

55-
The recommended way to install golangci-lint (replace `vX.Y.Z` with the latest
56-
version from the [releases page](https://github.com/golangci/golangci-lint/releases)):
55+
Latest version: ![GitHub release](https://img.shields.io/github/release/golangci/golangci-lint.svg)
56+
57+
Here is the recommended way to install golangci-lint (replace `vX.Y.Z` with the latest version):
5758

5859
```bash
5960
# binary will be $(go env GOPATH)/bin/golangci-lint
@@ -455,13 +456,13 @@ To exclude issues for the block of code use this directive on the beginning of a
455456
```go
456457
//nolint
457458
func allIssuesInThisFunctionAreExcluded() *string {
458-
// ...
459+
// ...
459460
}
460461

461462
//nolint:govet
462463
var (
463-
a int
464-
b int
464+
a int
465+
b int
465466
)
466467
```
467468

@@ -477,7 +478,7 @@ You may add a comment explaining or justifying why `//nolint` is being used on t
477478
```go
478479
//nolint:gocyclo // This legacy function is complex but the team too busy to simplify it
479480
func someLegacyFunction() *string {
480-
// ...
481+
// ...
481482
}
482483
```
483484

@@ -510,13 +511,15 @@ We don't recommend vendoring `golangci-lint` in your repo: you will get troubles
510511
No, you don't need to do it anymore.
511512

512513
**Which go versions are supported**
513-
Short answer: go 1.11 and newer are oficially supported.
514+
Short answer: go 1.12 and newer are oficially supported.
514515

515516
Long answer:
517+
516518
1. go < 1.9 isn't supported
517-
2. go 1.9 is supported by golangci-lint <= v1.10.2
518-
3. go 1.10 is officially supported by golangci-lint <= 1.15.0.
519-
4. go1.11 and go1.12 are officially supported by the latest version of golangci-lint.
519+
2. go1.9 is officially supported by golangci-lint <= v1.10.2
520+
3. go1.10 is officially supported by golangci-lint <= 1.15.0.
521+
4. go1.11 is officially supported by golangci-lint <= 1.17.1.
522+
5. go1.12 and go1.13 are officially supported by the latest version of golangci-lint (>= 1.18.0).
520523

521524
**`golangci-lint` doesn't work**
522525

go.mod

+11-7
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ require (
1414
github.com/golang/mock v1.0.0
1515
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2
1616
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a
17-
github.com/golangci/errcheck v0.0.0-20181003203344-ef45e06d44b6
17+
github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6
1818
github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613
1919
github.com/golangci/go-tools v0.0.0-20190318055746-e32c54105b7c
2020
github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3
2121
github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee
2222
github.com/golangci/gofmt v0.0.0-20181222123516-0b8337e80d98
23-
github.com/golangci/gosec v0.0.0-20180901114220-66fb7fc33547
23+
github.com/golangci/gosec v0.0.0-20190211064107-66fb7fc33547
2424
github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc
25-
github.com/golangci/lint-1 v0.0.0-20180610141402-ee948d087217
25+
github.com/golangci/lint-1 v0.0.0-20190420132249-ee948d087217
2626
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca
2727
github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770
2828
github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21
@@ -51,7 +51,7 @@ require (
5151
github.com/spf13/pflag v1.0.1
5252
github.com/spf13/viper v1.0.2
5353
github.com/stretchr/testify v1.2.2
54-
github.com/timakin/bodyclose v0.0.0-00010101000000-87058b9bfcec
54+
github.com/timakin/bodyclose v0.0.0-20190721030226-87058b9bfcec
5555
github.com/ultraware/funlen v0.0.1
5656
github.com/valyala/quicktemplate v1.1.1
5757
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a // indirect
@@ -62,8 +62,12 @@ require (
6262
gopkg.in/yaml.v2 v2.2.1
6363
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed
6464
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
65-
mvdan.cc/unparam v0.0.0-20190124213536-fbb59629db34
65+
mvdan.cc/unparam v0.0.0-20190209190245-fbb59629db34
6666
)
6767

68-
// https://github.com/golang/tools/pull/139
69-
replace golang.org/x/tools => github.com/golangci/tools v0.0.0-20190713050349-979bdb7f8cc8
68+
replace (
69+
// https://github.com/ultraware/funlen/pull/1
70+
github.com/ultraware/funlen => github.com/golangci/funlen v0.0.0-20190909161642-5e59b9546114
71+
// https://github.com/golang/tools/pull/139
72+
golang.org/x/tools => github.com/golangci/tools v0.0.0-20190909104219-979bdb7f8cc8
73+
)

0 commit comments

Comments
 (0)