diff --git a/.drone.yml b/.drone.yml index ee4883c7ea9..476c1237503 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,7 +17,7 @@ steps: image: grafana/build-container:1.4.1 commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/grabpl - chmod +x bin/grabpl - ./bin/grabpl verify-drone - curl -fLO https://github.com/jwilder/dockerize/releases/download/v$${DOCKERIZE_VERSION}/dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz @@ -251,7 +251,7 @@ steps: image: grafana/build-container:1.4.1 commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/grabpl - chmod +x bin/grabpl - ./bin/grabpl verify-drone - curl -fLO https://github.com/jwilder/dockerize/releases/download/v$${DOCKERIZE_VERSION}/dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz @@ -575,7 +575,7 @@ steps: image: grafana/ci-wix:0.1.1 commands: - $$ProgressPreference = "SilentlyContinue" - - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/windows/grabpl.exe -OutFile grabpl.exe + - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/windows/grabpl.exe -OutFile grabpl.exe - .\grabpl.exe verify-drone - name: build-windows-installer @@ -625,7 +625,7 @@ steps: image: grafana/build-container:1.4.1 commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/grabpl - chmod +x bin/grabpl - ./bin/grabpl verify-drone environment: @@ -710,7 +710,7 @@ steps: image: grafana/build-container:1.4.1 commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/grabpl - chmod +x bin/grabpl - ./bin/grabpl verify-drone - ./bin/grabpl verify-version ${DRONE_TAG} @@ -1009,7 +1009,7 @@ steps: image: grafana/ci-wix:0.1.1 commands: - $$ProgressPreference = "SilentlyContinue" - - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/windows/grabpl.exe -OutFile grabpl.exe + - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/windows/grabpl.exe -OutFile grabpl.exe - .\grabpl.exe verify-drone - name: build-windows-installer @@ -1060,7 +1060,7 @@ steps: image: grafana/build-container:1.4.1 commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/grabpl - chmod +x bin/grabpl - git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" - cd grafana-enterprise @@ -1474,7 +1474,7 @@ steps: image: grafana/ci-wix:0.1.1 commands: - $$ProgressPreference = "SilentlyContinue" - - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/windows/grabpl.exe -OutFile grabpl.exe + - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/windows/grabpl.exe -OutFile grabpl.exe - git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git" - cd grafana-enterprise - git checkout ${DRONE_TAG} @@ -1540,7 +1540,7 @@ steps: image: grafana/build-container:1.4.1 commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/grabpl - chmod +x bin/grabpl - ./bin/grabpl verify-drone - ./bin/grabpl verify-version ${DRONE_TAG} @@ -1645,7 +1645,7 @@ steps: image: grafana/build-container:1.4.1 commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/grabpl - chmod +x bin/grabpl - ./bin/grabpl verify-drone - ./bin/grabpl verify-version v7.3.0-test @@ -1933,7 +1933,7 @@ steps: image: grafana/ci-wix:0.1.1 commands: - $$ProgressPreference = "SilentlyContinue" - - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/windows/grabpl.exe -OutFile grabpl.exe + - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/windows/grabpl.exe -OutFile grabpl.exe - .\grabpl.exe verify-drone - name: build-windows-installer @@ -1984,7 +1984,7 @@ steps: image: grafana/build-container:1.4.1 commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/grabpl - chmod +x bin/grabpl - git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" - cd grafana-enterprise @@ -2392,7 +2392,7 @@ steps: image: grafana/ci-wix:0.1.1 commands: - $$ProgressPreference = "SilentlyContinue" - - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/windows/grabpl.exe -OutFile grabpl.exe + - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/windows/grabpl.exe -OutFile grabpl.exe - git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git" - cd grafana-enterprise - git checkout master @@ -2458,7 +2458,7 @@ steps: image: grafana/build-container:1.4.1 commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/grabpl - chmod +x bin/grabpl - ./bin/grabpl verify-drone - ./bin/grabpl verify-version v7.3.0-test @@ -2563,7 +2563,7 @@ steps: image: grafana/build-container:1.4.1 commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/grabpl - chmod +x bin/grabpl - ./bin/grabpl verify-drone - curl -fLO https://github.com/jwilder/dockerize/releases/download/v$${DOCKERIZE_VERSION}/dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz @@ -2826,7 +2826,7 @@ steps: image: grafana/ci-wix:0.1.1 commands: - $$ProgressPreference = "SilentlyContinue" - - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/windows/grabpl.exe -OutFile grabpl.exe + - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/windows/grabpl.exe -OutFile grabpl.exe - .\grabpl.exe verify-drone - name: build-windows-installer @@ -2873,7 +2873,7 @@ steps: image: grafana/build-container:1.4.1 commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/grabpl - chmod +x bin/grabpl - git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" - cd grafana-enterprise @@ -3284,7 +3284,7 @@ steps: image: grafana/ci-wix:0.1.1 commands: - $$ProgressPreference = "SilentlyContinue" - - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.48/windows/grabpl.exe -OutFile grabpl.exe + - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.53/windows/grabpl.exe -OutFile grabpl.exe - git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git" - cd grafana-enterprise - git checkout $$env:DRONE_BRANCH diff --git a/Makefile b/Makefile index 8fb27210cb4..c2296090f0c 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ -include local/Makefile -.PHONY: all deps-go deps-js deps build-go build-server build-cli build-js build build-docker-dev build-docker-full lint-go revive golangci-lint test-go test-js test run run-frontend clean devenv devenv-down revive-strict protobuf help +.PHONY: all deps-go deps-js deps build-go build-server build-cli build-js build build-docker-dev build-docker-full lint-go golangci-lint test-go test-js test run run-frontend clean devenv devenv-down protobuf help GO = GO111MODULE=on go GO_FILES ?= ./pkg/... @@ -69,22 +69,6 @@ test-js: ## Run tests for frontend. test: test-go test-js ## Run all tests. ##@ Linting - -scripts/go/bin/revive: scripts/go/go.mod - @cd scripts/go; \ - $(GO) build -o ./bin/revive github.com/mgechev/revive - -revive: scripts/go/bin/revive - @echo "lint via revive" - @scripts/go/bin/revive \ - -formatter stylish \ - -config ./scripts/go/configs/revive.toml \ - $(GO_FILES) - -revive-strict: scripts/go/bin/revive - @echo "lint via revive (strict)" - @scripts/revive-strict scripts/go/bin/revive - scripts/go/bin/golangci-lint: scripts/go/go.mod @cd scripts/go; \ $(GO) build -o ./bin/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint @@ -95,7 +79,7 @@ golangci-lint: scripts/go/bin/golangci-lint --config ./scripts/go/configs/.golangci.toml \ $(GO_FILES) -lint-go: golangci-lint revive revive-strict # Run all code checks for backend. +lint-go: golangci-lint # Run all code checks for backend. # with disabled SC1071 we are ignored some TCL,Expect `/usr/bin/env expect` scripts shellcheck: $(SH_FILES) ## Run checks for shell scripts. diff --git a/go.sum b/go.sum index 786b2ff1aad..a4d306962f2 100644 --- a/go.sum +++ b/go.sum @@ -1044,7 +1044,6 @@ github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E github.com/jung-kurt/gofpdf v1.16.2 h1:jgbatWHfRlPYiK85qgevsZTHviWXKwB1TTiKdz5PtRc= github.com/jung-kurt/gofpdf v1.16.2/go.mod h1:1hl7y57EsiPAkLbOwzpzqgx1A30nQCk/YmFV8S2vmK0= github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= -github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw= github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= diff --git a/scripts/go/configs/.golangci.toml b/scripts/go/configs/.golangci.toml index a914a147557..b47e0ae2f7a 100644 --- a/scripts/go/configs/.golangci.toml +++ b/scripts/go/configs/.golangci.toml @@ -11,6 +11,11 @@ min-occurrences = 5 [linters-settings.exhaustive] default-signifies-exhaustive = true +[linters-settings.revive] +ignore-generated-header = false +severity = "warning" +confidence = 3 + [linters-settings.gocritic] enabled-checks = ["ruleguard"] [linters-settings.gocritic.settings.ruleguard] @@ -52,6 +57,7 @@ enable = [ "asciicheck", "errorlint", "sqlclosecheck", + "revive", ] # Disabled linters (might want them later) diff --git a/scripts/go/configs/revive-strict.toml b/scripts/go/configs/revive-strict.toml deleted file mode 100644 index 05e1510af1a..00000000000 --- a/scripts/go/configs/revive-strict.toml +++ /dev/null @@ -1,26 +0,0 @@ -ignoreGeneratedHeader = false -severity = "error" -confidence = 0.8 -errorCode = 1 -warningCode = 1 - -[rule.context-as-argument] -[rule.error-return] -[rule.package-comments] -[rule.range] -[rule.superfluous-else] -[rule.modifies-parameter] -[rule.indent-error-flow] -[rule.error-strings] -[rule.error-naming] -[rule.exported] -[rule.unexported-return] -[rule.dot-imports] -[rule.receiver-naming] -[rule.blank-imports] -[rule.var-naming] - -# This can be checked by other tools like megacheck -[rule.unreachable-code] - - diff --git a/scripts/go/configs/revive.toml b/scripts/go/configs/revive.toml deleted file mode 100644 index a40486c3133..00000000000 --- a/scripts/go/configs/revive.toml +++ /dev/null @@ -1,25 +0,0 @@ -ignoreGeneratedHeader = false -severity = "error" -confidence = 0.8 -errorCode = 1 - -[rule.context-as-argument] -[rule.error-return] -[rule.package-comments] -[rule.range] -[rule.superfluous-else] -[rule.modifies-parameter] -[rule.indent-error-flow] -[rule.error-strings] -[rule.error-naming] - -# This can be checked by other tools like megacheck -[rule.unreachable-code] - -# Those are probably should be enabled at some point -# [rule.unexported-return] -# [rule.exported] -# [rule.var-naming] -# [rule.dot-imports] -# [rule.receiver-naming] -# [rule.blank-imports] diff --git a/scripts/go/go.mod b/scripts/go/go.mod index 688f70b96eb..ee314f52c79 100644 --- a/scripts/go/go.mod +++ b/scripts/go/go.mod @@ -5,7 +5,6 @@ go 1.14 require ( github.com/golangci/golangci-lint v1.37.1 github.com/mattn/go-runewidth v0.0.9 // indirect - github.com/mgechev/revive v1.0.3 github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/unknwon/bra v0.0.0-20200517080246-1e3013ecaff8 github.com/unknwon/log v0.0.0-20200308114134-929b1006e34a // indirect diff --git a/scripts/go/tools.go b/scripts/go/tools.go index dda10bced15..aff62dcf48b 100644 --- a/scripts/go/tools.go +++ b/scripts/go/tools.go @@ -4,6 +4,5 @@ package main import ( _ "github.com/golangci/golangci-lint/cmd/golangci-lint" - _ "github.com/mgechev/revive" _ "github.com/unknwon/bra" ) diff --git a/scripts/lib.star b/scripts/lib.star index 70264f9ae89..b57b3449794 100644 --- a/scripts/lib.star +++ b/scripts/lib.star @@ -1,4 +1,4 @@ -grabpl_version = '0.5.48' +grabpl_version = '0.5.53' build_image = 'grafana/build-container:1.4.1' publish_image = 'grafana/grafana-ci-deploy:1.3.1' grafana_docker_image = 'grafana/drone-grafana-docker:0.3.2' diff --git a/scripts/revive-strict b/scripts/revive-strict deleted file mode 100755 index 18a02b6d738..00000000000 --- a/scripts/revive-strict +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -set -eo pipefail - -SCRIPT=${1:-revive} - -$SCRIPT \ - -formatter stylish \ - -config scripts/go/configs/revive-strict.toml \ - -exclude ./pkg/plugins/backendplugin/pluginextensionv2/... \ - ./pkg/services/alerting/... \ - ./pkg/services/provisioning/datasources/... \ - ./pkg/services/provisioning/dashboards/... \ - ./pkg/services/provisioning/notifiers/... \ - ./pkg/services/provisioning/values/... \ - ./pkg/plugins/backendplugin/...