replace gometalinter with golangci-lint (#596)

Former-commit-id: f43cff5a88f9b70f593cf612832428f71decd92f [formerly 7f5f957bc17fb9e03b37224a1cc31ad65af5468c] [formerly 8e8a054716b10a3999bf75deea0f0d3759c1ac42 [formerly 835c37d1e3]]
Former-commit-id: 970cbb1ad8489d7117ee580339709a07652def96 [formerly f7a47fc1f409b3acc390fa039c0076b208931748]
Former-commit-id: ec3c2df078a903c6485dd74207e34bab08f1d9c1
This commit is contained in:
1138-4EB 2019-01-02 03:13:53 +01:00 committed by GitHub
parent 901dc2c160
commit 74e93b8df0
6 changed files with 35 additions and 71 deletions

20
.golangci.yml Normal file
View File

@ -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

View File

@ -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"
]
}

View File

@ -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:

View File

@ -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

View File

@ -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

13
build/run_linters.sh Executable file
View File

@ -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