Skip to content

Commit

Permalink
Merge pull request #17 from maratori/update
Browse files Browse the repository at this point in the history
Minor updates
  • Loading branch information
maratori committed Apr 22, 2020
2 parents 1b1da12 + f9bc51b commit 68d85e4
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 26 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.idea/
.DS_Store
*.out
coverage.out
go.check.mod
go.check.sum
19 changes: 16 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ linters-settings:
check-exported: true # default false
varcheck:
exported-fields: true # default false

dupl:
threshold: 150 # default 150
funlen:
lines: 60 # default 60
statements: 40 # default 40
gocognit:
min-complexity: 10 # minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 15 # minimal code complexity to report, 30 by default (but we recommend 10-20)
goconst:
min-len: 3 # default 3
min-occurrences: 3 # default 3
Expand All @@ -42,7 +43,13 @@ linters-settings:
goimports:
local-prefixes: github.com/maratori/testpackage
golint:
min-confidence: 0.1 # default 0.8
min-confidence: 0 # default 0.8
gomnd:
settings:
mnd:
# the list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.
checks: argument,case,condition,operation,return,assign # default argument,case,condition,operation,return,assign
ignored-numbers: 0,1 # default 0,1
lll:
line-length: 120 # default 120
maligned:
Expand Down Expand Up @@ -78,7 +85,7 @@ linters:
- structcheck
- typecheck
#- unused # false positives
#- varcheck # false positives
- varcheck
## disabled by default
- bodyclose
- dupl
Expand All @@ -91,18 +98,24 @@ linters:
- gocyclo
- goimports
- golint
- gomnd
- goprintffuncname
- gosec
- lll
- maligned
- misspell
- nakedret
- prealloc
- rowserrcheck
- scopelint
- unconvert
- unparam
- whitespace
- wsl

output:
uniq-by-line: false # default true

issues:
max-issues-per-linter: 0
max-same-issues: 0
Expand Down
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
language: go
os: linux
dist: xenial
go:
- "1.11.x"
- "1.12.x"
matrix:
- 1.12.x
- 1.13.x
- 1.14.x
jobs:
include:
- go: "1.13.x"
- go: 1.x
script:
- make ci
after_success:
Expand Down
34 changes: 21 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
ci: test-cover lint check-tidy
.PHONY: ci
ci: testcov lint istidy

.PHONY: test
test:
go test -race ./...
.PHONY: test

.PHONY: lint
lint:
docker run --rm --name lint -v `pwd`:/app -w /app golangci/golangci-lint:v1.21.0 golangci-lint run
docker run --rm --name lint -v `pwd`:/app -w /app golangci/golangci-lint:v1.24.0 golangci-lint run
.PHONY: lint

.PHONY: tidy
tidy:
go mod tidy
.PHONY: tidy

.PHONY: testcov
testcov:
go test -race -coverpkg ./... -coverprofile=coverage.out ./...

.PHONY: istidy
istidy:
update-deps:
go get -u -t ./...
go mod tidy
if [[ `git status --porcelain go.mod` ]]; then git diff -- go.mod ; echo "go.mod is outdated, please run go mod tidy" ; exit 1; fi
if [[ `git status --porcelain go.sum` ]]; then git diff -- go.sum ; echo "go.sum is outdated, please run go mod tidy" ; exit 1; fi
.PHONY: update-deps

check-tidy:
cp go.mod go.check.mod
cp go.sum go.check.sum
go mod tidy -modfile=go.check.mod
diff -u go.mod go.check.mod
diff -u go.sum go.check.sum
rm go.check.mod go.check.sum
.PHONY: check-tidy

test-cover:
go test -race -coverpkg ./... -coverprofile=coverage.out ./...
.PHONY: test-cover
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ More detailed articles on this topic:
## Usage

The best way is to use [golangci-lint](https://github.com/golangci/golangci-lint).
It includes **testpackage** linter started from v1.22.0 and higher.
It includes **testpackage** linter started from v1.25.0 and higher.

### Install
See [install section](https://github.com/golangci/golangci-lint#install) of readme.
Expand Down Expand Up @@ -91,6 +91,14 @@ Flags: -V print version and exit

## Changelog

### [v1.0.1] - 2020-04-22

#### Changed
* No changes in linter behavior
* Use latest go version on travis-ci
* Update Makefile
* Update golangci-lint

### [v1.0.0] - 2019-11-10

#### Added
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/maratori/testpackage

go 1.13
go 1.12 // minimal supported version

require golang.org/x/tools v0.0.0-20191101200257-8dbcdeb83d3f
require golang.org/x/tools v0.0.0-20200422022333-3d57cf2e726e
16 changes: 14 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20191101200257-8dbcdeb83d3f h1:+QO45yvqhfD79HVNFPAgvstYLFye8zA+rd0mHFsGV9s=
golang.org/x/tools v0.0.0-20191101200257-8dbcdeb83d3f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200422022333-3d57cf2e726e h1:3Dzrrxi54Io7Aoyb0PYLsI47K2TxkRQg+cqUn+m04do=
golang.org/x/tools v0.0.0-20200422022333-3d57cf2e726e/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

0 comments on commit 68d85e4

Please sign in to comment.