Skip to content

Commit

Permalink
Delete envvarlinter and testlinter. (istio#17115)
Browse files Browse the repository at this point in the history
- Both linters have been moved to the tools repo, so get them from there instead.

- Update the lint_modern target to use the in-container version of envvarlinter and
testlinter

- Update the lint_modern target to run golangci-lint. We can't use the normal lint-go
logic since it blows up in terms of resource consumption (30GB!). Instesd, we ran the
linter on individual directories, which keeps peek memory use to a still impressive but
more acceptable ~5GB.
  • Loading branch information
geeknoid authored Sep 17, 2019
1 parent ccb257b commit 818e31b
Show file tree
Hide file tree
Showing 38 changed files with 25 additions and 1,862 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
export BUILD_WITH_CONTAINER ?= 0

ifeq ($(BUILD_WITH_CONTAINER),1)
IMG = gcr.io/istio-testing/build-tools:2019-09-11T09-52-48
IMG = gcr.io/istio-testing/build-tools:2019-09-16T11-57-35
UID = $(shell id -u)
PWD = $(shell pwd)
GOBIN_SOURCE ?= $(GOPATH)/bin
Expand Down
12 changes: 12 additions & 0 deletions Makefile.core.mk
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,18 @@ shellcheck:
MARKDOWN_LINT_WHITELIST=localhost:8080,storage.googleapis.com/istio-artifacts/pilot/,http://ratings.default.svc.cluster.local:9080/ratings

lint_modern: lint-python lint-copyright-banner lint-scripts lint-dockerfiles lint-markdown lint-yaml
@golangci-lint run -c ./common/config/.golangci.yml ./galley/...
@golangci-lint run -c ./common/config/.golangci.yml ./istioctl/...
@golangci-lint run -c ./common/config/.golangci.yml ./mixer/...
@golangci-lint run -c ./common/config/.golangci.yml ./pilot/...
@golangci-lint run -c ./common/config/.golangci.yml ./pkg/...
@golangci-lint run -c ./common/config/.golangci.yml ./samples/...
@golangci-lint run -c ./common/config/.golangci.yml ./security/...
@golangci-lint run -c ./common/config/.golangci.yml ./sidecar-injector/...
@golangci-lint run -c ./common/config/.golangci.yml ./tests/...
@golangci-lint run -c ./common/config/.golangci.yml ./tools/...
@testlinter
@envvarlinter galley istioctl mixer pilot security sidecar-injector

#-----------------------------------------------------------------------------
# Target: go build
Expand Down
8 changes: 4 additions & 4 deletions bin/linters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ function run_adapter_lint() {

function run_test_lint() {
echo 'Running testlinter ...'
go build -o bin/testlinter tools/checker/testlinter/*.go
bin/testlinter
GO111MODULE=off go get -u istio.io/tools/cmd/testlinter
testlinter
echo 'testlinter OK'
}

function run_envvar_lint() {
echo 'Running envvarlinter ...'
go build -o bin/envvarlinter tools/checker/envvarlinter/*.go
bin/envvarlinter mixer pilot security galley istioctl
GO111MODULE=off go get -u istio.io/tools/cmd/envvarlinter
envvarlinter galley istioctl mixer pilot security sidecar-injector
echo 'envvarlinter OK'
}

Expand Down
2 changes: 1 addition & 1 deletion common/.commonfiles.sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0c08017c3bfe198f061322c98c36e4e3638a09ad
a99504efa8ef5e5da9f1350581206caf8610e47d
8 changes: 6 additions & 2 deletions common/config/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

service:
# When updating this, also update the version stored in docker/build-tools/Dockerfile in the istio/tools repo.
golangci-lint-version: 1.16.x # use the fixed version to not introduce new linters unexpectedly
golangci-lint-version: 1.18.x # use the fixed version to not introduce new linters unexpectedly
run:
# timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 20m
Expand Down Expand Up @@ -42,6 +42,8 @@ linters:
- nakedret
- prealloc
- scopelint
- funlen
- bodyclose
fast: false

linters-settings:
Expand Down Expand Up @@ -74,6 +76,8 @@ linters-settings:
# Default is to use a neutral variety of English.
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
locale: US
ignore-words:
- cancelled
lll:
# max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
Expand Down Expand Up @@ -142,9 +146,9 @@ linters-settings:
- unslice
- valSwap
- weakCond
- yodaStyleExpr

# Unused
# - yodaStyleExpr
# - appendAssign
# - commentFormatting
# - emptyStringTest
Expand Down
2 changes: 1 addition & 1 deletion common/scripts/lint_go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

golangci-lint run -j 8 -c ./common/config/.golangci.yml
GOGC=10 golangci-lint run -c ./common/config/.golangci.yml
97 changes: 0 additions & 97 deletions tools/checker/README.md

This file was deleted.

106 changes: 0 additions & 106 deletions tools/checker/checker.go

This file was deleted.

31 changes: 0 additions & 31 deletions tools/checker/envvarlinter/README.md

This file was deleted.

40 changes: 0 additions & 40 deletions tools/checker/envvarlinter/envvar_test.go

This file was deleted.

Loading

0 comments on commit 818e31b

Please sign in to comment.