mirror of
https://github.com/containers/skopeo.git
synced 2026-02-05 12:45:43 +01:00
golangci-lint: enable gofumpt formatter
And also remove old, no longer needed validate-gofmt.sh script. golangci-lint checks the formatting already for us. And add a fmt make target that just runs golangci-lint fmt for easier use. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
committed by
Miloslav Trmač
parent
7182fecc79
commit
b625905314
@@ -1,4 +1,9 @@
|
||||
version: "2"
|
||||
|
||||
formatters:
|
||||
enable:
|
||||
- gofumpt
|
||||
|
||||
linters:
|
||||
settings:
|
||||
staticcheck:
|
||||
|
||||
5
Makefile
5
Makefile
@@ -242,10 +242,13 @@ validate:
|
||||
# This target is only intended for development, e.g. executing it from an IDE. Use (make test) for CI or pre-release testing.
|
||||
test-all-local: validate-local validate-docs test-unit-local
|
||||
|
||||
.PHONY: fmt
|
||||
fmt: tools
|
||||
$(GOBIN)/golangci-lint fmt
|
||||
|
||||
.PHONY: validate-local
|
||||
validate-local: tools
|
||||
hack/validate-git-marks.sh
|
||||
hack/validate-gofmt.sh
|
||||
$(GOBIN)/golangci-lint run --build-tags "${BUILDTAGS}"
|
||||
# An extra run with --tests=false allows detecting code unused outside of tests;
|
||||
# ideally the linter should be able to find this automatically.
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
IFS=$'\n'
|
||||
files=( $(find . -name '*.go' | grep -v '^./vendor/' | sort || true) )
|
||||
unset IFS
|
||||
|
||||
badFiles=()
|
||||
for f in "${files[@]}"; do
|
||||
if [ "$(gofmt -s -l < $f)" ]; then
|
||||
badFiles+=( "$f" )
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#badFiles[@]} -eq 0 ]; then
|
||||
echo 'Congratulations! All Go source files are properly formatted.'
|
||||
else
|
||||
{
|
||||
echo "These files are not properly gofmt'd:"
|
||||
for f in "${badFiles[@]}"; do
|
||||
echo " - $f"
|
||||
done
|
||||
echo
|
||||
echo 'Please reformat the above files using "gofmt -s -w" and commit the result.'
|
||||
echo
|
||||
} >&2
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user