mirror of
https://github.com/containers/skopeo.git
synced 2025-04-28 11:14:08 +00:00
Use golangci-lint instead of golint
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
parent
c538340e3b
commit
d4bd787e5f
@ -53,6 +53,7 @@ validate_task:
|
|||||||
cpu: 4
|
cpu: 4
|
||||||
memory: 8
|
memory: 8
|
||||||
script: |
|
script: |
|
||||||
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.2
|
||||||
make validate-local
|
make validate-local
|
||||||
make vendor && hack/tree_status.sh
|
make vendor && hack/tree_status.sh
|
||||||
|
|
||||||
@ -91,7 +92,7 @@ osx_task:
|
|||||||
export PATH=$GOPATH/bin:$PATH
|
export PATH=$GOPATH/bin:$PATH
|
||||||
brew update
|
brew update
|
||||||
brew install gpgme go go-md2man
|
brew install gpgme go go-md2man
|
||||||
go install golang.org/x/lint/golint@latest
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.2
|
||||||
test_script: |
|
test_script: |
|
||||||
export PATH=$GOPATH/bin:$PATH
|
export PATH=$GOPATH/bin:$PATH
|
||||||
go version
|
go version
|
||||||
|
2
Makefile
2
Makefile
@ -227,7 +227,7 @@ test-all-local: validate-local validate-docs test-unit-local
|
|||||||
validate-local:
|
validate-local:
|
||||||
hack/validate-git-marks.sh
|
hack/validate-git-marks.sh
|
||||||
hack/validate-gofmt.sh
|
hack/validate-gofmt.sh
|
||||||
hack/validate-lint.sh
|
GOBIN=$(GOBIN) hack/validate-lint.sh
|
||||||
BUILDTAGS="${BUILDTAGS}" hack/validate-vet.sh
|
BUILDTAGS="${BUILDTAGS}" hack/validate-vet.sh
|
||||||
|
|
||||||
# This invokes bin/skopeo, hence cannot be run as part of validate-local
|
# This invokes bin/skopeo, hence cannot be run as part of validate-local
|
||||||
|
@ -1,27 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
IFS=$'\n'
|
errors=$($GOBIN/golangci-lint run --build-tags "${BUILDTAGS}" 2>&1)
|
||||||
files=( $(find . -name '*.go' | grep -v '^\./vendor/' | sort || true) )
|
|
||||||
unset IFS
|
|
||||||
|
|
||||||
errors=()
|
if [ -z "$errors" ]; then
|
||||||
for f in "${files[@]}"; do
|
|
||||||
failedLint=$(golint "$f")
|
|
||||||
if [ "$failedLint" ]; then
|
|
||||||
errors+=( "$failedLint" )
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ${#errors[@]} -eq 0 ]; then
|
|
||||||
echo 'Congratulations! All Go source files have been linted.'
|
echo 'Congratulations! All Go source files have been linted.'
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "Errors from golint:"
|
echo "Errors from golangci-lint:"
|
||||||
for err in "${errors[@]}"; do
|
echo "$errors"
|
||||||
echo "$err"
|
|
||||||
done
|
|
||||||
echo
|
echo
|
||||||
echo 'Please fix the above errors. You can test via "golint" and commit the result.'
|
echo 'Please fix the above errors. You can test via "golangci-lint" and commit the result.'
|
||||||
echo
|
echo
|
||||||
} >&2
|
} >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user