Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Commit

Permalink
golangci-lint beginnings and errcheck fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
laverya committed Aug 27, 2019
1 parent 0061de0 commit b00547a
Show file tree
Hide file tree
Showing 317 changed files with 32,078 additions and 10,683 deletions.
3 changes: 3 additions & 0 deletions .errcheck.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(*github.com/go-kit/kit/log.Logger).Log
(*github.com/replicatedhq/ship/pkg/testing/logger.TestLogger).Log
(*github.com/gin-gonic/gin.Context).AbortWithError
13 changes: 13 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
run:
deadline: 2m

linters-settings:
errcheck:
# path to a file containing a list of functions to exclude from checking
# see https://github.com/kisielk/errcheck#excluding-functions for details
exclude: ./.errcheck.txt

# [deprecated] comma-separated list of pairs of the form pkg:regex
# the regex is used to ignore names within pkg. (default "fmt:.*").
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
ignore: fmt:.*,github.com/go-kit/kit/log:.*
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

.PHONY: build-deps dep-deps docker shell githooks dep e2e run citest ci-upload-coverage goreleaser integration-test build_ship_integration_test build-ui build-ui-dev mark-ui-gitignored fmt lint vet test build embed-ui clean-ship clean clean-integration

export GO111MODULE=on

SHELL := /bin/bash -o pipefail
SRC = $(shell find pkg -name "*.go" ! -name "ui.bindatafs.go")
Expand Down Expand Up @@ -254,22 +255,22 @@ fmt: .state/build-deps .state/fmt

vet: .state/vet

.state/ineffassign: .state/build-deps $(SRC)
ineffassign ./pkg
ineffassign ./cmd
ineffassign ./integration
.state/golangci-lint: .state/build-deps $(SRC)
golangci-lint run ./pkg/...
golangci-lint run ./cmd/...
golangci-lint run ./integration/...
@mkdir -p .state
@touch .state/ineffassign
@touch .state/golangci-lint

ineffassign: .state/ineffassign
golangci-lint: .state/golangci-lint

.state/lint: $(SRC)
golint ./pkg/... | grep -vE '_mock|e2e' | grep -v "should have comment" | grep -v "comment on exported" | grep -v "package comment should be of the form" | grep -v bindatafs || :
golint ./cmd/... | grep -vE '_mock|e2e' | grep -v "should have comment" | grep -v "comment on exported" | grep -v "package comment should be of the form" | grep -v bindatafs || :
@mkdir -p .state
@touch .state/lint

lint: vet ineffassign .state/lint
lint: vet golangci-lint .state/lint

.state/test: $(SRC)
go test ./pkg/... ./integration | grep -v '?'
Expand All @@ -290,7 +291,7 @@ race: lint .state/race
#the reduced parallelism here is to avoid hitting the memory limits - we consistently did so with two threads on a 4gb instance
go test -parallel 1 -p 1 -coverprofile=.state/coverage.out ./pkg/... ./integration

citest: .state/vet .state/ineffassign .state/lint .state/coverage.out
citest: .state/vet .state/golangci-lint .state/lint .state/coverage.out

.state/cc-test-reporter:
@mkdir -p .state/
Expand Down
18 changes: 12 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ require (
github.com/go-stack/stack v1.8.0
github.com/go-test/deep v1.0.1
github.com/gobuffalo/packr v1.30.1 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/golang/mock v1.2.0
github.com/golang/mock v1.3.1
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
github.com/golangci/golangci-lint v1.17.1 // indirect
github.com/google/certificate-transparency-go v1.0.21 // indirect
github.com/google/go-github/v18 v18.0.0
github.com/google/go-querystring v1.0.0
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf // indirect
github.com/google/uuid v1.1.0 // indirect
github.com/googleapis/gnostic v0.2.0 // indirect
github.com/gordonklaus/ineffassign v0.0.0-20190601041439-ed7b1b5ee0f8 // indirect
github.com/gosuri/uitable v0.0.0-20160404203958-36ee7e946282
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/hashicorp/go-getter v0.0.0-20180809191950-4bda8fa99001
Expand All @@ -72,10 +73,10 @@ require (
github.com/jarcoal/httpmock v0.0.0-20180424175123-9c70cfe4a1da
github.com/jmoiron/sqlx v1.2.0 // indirect
github.com/json-iterator/go v0.0.0-20180701071628-ab8a2e0c74be // indirect
github.com/jteeuwen/go-bindata v3.0.7+incompatible // indirect
github.com/lib/pq v1.1.1 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mailru/easyjson v0.0.0-20180723221831-d5012789d665 // indirect
github.com/mattn/go-isatty v0.0.3 // indirect
github.com/mattn/go-runewidth v0.0.3 // indirect
github.com/mcuadros/go-jsonschema-generator v0.0.0-20171001215842-821f57ef6082
github.com/mholt/archiver v0.0.0-20180417220235-e4ef56d48eb0
Expand All @@ -87,8 +88,8 @@ require (
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect
github.com/mozilla-services/yaml v0.0.0-20180922153656-28ffe5d0cafb // indirect
github.com/nwaples/rardecode v0.0.0-20171029023500-e06696f847ae // indirect
github.com/onsi/ginkgo v1.5.0
github.com/onsi/gomega v1.4.0
github.com/onsi/ginkgo v1.6.0
github.com/onsi/gomega v1.4.2
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/pact-foundation/pact-go v1.0.0-beta.5
Expand All @@ -110,8 +111,13 @@ require (
github.com/zclconf/go-cty v0.0.0-20181017232614-01c5aba823a6 // indirect
github.com/ziutek/mymysql v1.5.4 // indirect
go.uber.org/dig v1.3.0
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586
golang.org/x/lint v0.0.0-20190409202823-959b441ac422 // indirect
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect
golang.org/x/oauth2 v0.0.0-20181120190819-8f65e3013eba
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 // indirect
golang.org/x/text v0.3.2 // indirect
golang.org/x/tools v0.0.0-20190827152308-062dbaebb618 // indirect
google.golang.org/appengine v1.3.0 // indirect
google.golang.org/grpc v1.21.0
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
Expand Down
Loading

0 comments on commit b00547a

Please sign in to comment.