From 74e93b8df0b46096e81883b687db4197d54bd410 Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Wed, 2 Jan 2019 03:13:53 +0100 Subject: [PATCH] replace gometalinter with golangci-lint (#596) Former-commit-id: f43cff5a88f9b70f593cf612832428f71decd92f [formerly 7f5f957bc17fb9e03b37224a1cc31ad65af5468c] [formerly 8e8a054716b10a3999bf75deea0f0d3759c1ac42 [formerly 835c37d1e3fa7442c76b85eec92d6590332b53d1]] Former-commit-id: 970cbb1ad8489d7117ee580339709a07652def96 [formerly f7a47fc1f409b3acc390fa039c0076b208931748] Former-commit-id: ec3c2df078a903c6485dd74207e34bab08f1d9c1 --- .golangci.yml | 20 ++++++++++++++++++++ .gometalinter.json | 38 -------------------------------------- .travis.yml | 2 +- build/build_all.sh | 15 +-------------- build/run_gometalinter.sh | 18 ------------------ build/run_linters.sh | 13 +++++++++++++ 6 files changed, 35 insertions(+), 71 deletions(-) create mode 100644 .golangci.yml delete mode 100644 .gometalinter.json delete mode 100755 build/run_gometalinter.sh create mode 100755 build/run_linters.sh diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 00000000..20ad14f9 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,20 @@ +run: + deadline: 5m + +linters: + enable: + - deadcode + - govet + - ineffassign + - interfacer + - maligned + - megacheck + - structcheck + - unconvert + - varcheck + enable-all: false + disable-all: true +# presets: +# - bugs +# - unused + fast: false diff --git a/.gometalinter.json b/.gometalinter.json deleted file mode 100644 index ac903f42..00000000 --- a/.gometalinter.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "Enable": [ - "deadcode", - "gotype", - "gotypex", - "ineffassign", - "interfacer", - "maligned", - "megacheck", - "structcheck", - "unconvert", - "varcheck", - "vet" - ], - "Disable": [ - "dupl", - "errcheck", - "gochecknoglobals", - "gochecknoinits", - "goconst", - "gocyclo", - "gofmt", - "goimports", - "golint", - "gosec", - "gosimple", - "lll", - "misspell", - "nakedret", - "safesql", - "staticcheck", - "test", - "testify", - "unparam", - "unused", - "vetshadow" - ] -} diff --git a/.travis.yml b/.travis.yml index 20e27616..89a5034e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ cache: jobs: include: - stage: lint - script: "./build/run_gometalinter.sh" + script: "./build/run_linters.sh" - stage: test script: "./build/build_all.sh" deploy: diff --git a/build/build_all.sh b/build/build_all.sh index e8954ac8..af5c3055 100755 --- a/build/build_all.sh +++ b/build/build_all.sh @@ -17,8 +17,7 @@ if [ "$USE_DOCKER" != "" ]; then COMMIT_SHA="untracked" fi - $(command -v winpty) docker run -it \ - --name filebrowser-tmp \ + $(command -v winpty) docker run --rm -it \ -v /$(pwd):/src:z \ -w //src \ -e COMMIT_SHA=$COMMIT_SHA \ @@ -30,18 +29,6 @@ if [ "$USE_DOCKER" != "" ]; then ./build_assets.sh && \ ./build.sh \ " - exitcode=$? - - if [ $exitcode -eq 0 ]; then - for d in "dist/" "node_modules/"; do - docker cp filebrowser-tmp://src/frontend/$d frontend - done - docker cp filebrowser-tmp://src/cli/filebrowser ./filebrowser - docker cp filebrowser-tmp://src/lib/rice-box.go ./lib/rice-box.go - else - echo "BUILD FAILED!" - fi - docker rm -f filebrowser-tmp else set -e ./build/build_assets.sh diff --git a/build/run_gometalinter.sh b/build/run_gometalinter.sh deleted file mode 100755 index 8ed2fdc0..00000000 --- a/build/run_gometalinter.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -set -e - -cd $(dirname $0)/.. - -dolint='gometalinter --exclude="rice-box.go" --exclude="vendor" --deadline=300s ./...' - -WDIR="/go/src/github.com/filebrowser/filebrowser" - -if [ "$USE_DOCKER" != "" ]; then - $(command -v winpty) docker run --rm -itv "/$(pwd):/$WDIR" -w "/$WDIR" filebrowser/dev sh -c "\ - GO111MODULE=on go get -v ./... && \ - GO111MODULE=on go mod vendor && \ - GO111MODULE=off $dolint" -else - $dolint -fi diff --git a/build/run_linters.sh b/build/run_linters.sh new file mode 100755 index 00000000..cef68670 --- /dev/null +++ b/build/run_linters.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +cd $(dirname $0)/.. + +if [ "$USE_DOCKER" != "" ]; then + $(command -v winpty) docker run --rm -itv "/$(pwd)://src" -w "//src" filebrowser/dev sh -c "\ + go get -v ./... && \ + golangci-lint run -v" +else + golangci-lint run -v +fi