Skip to content

Commit

Permalink
switch to gofumpt
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Morelly committed Apr 26, 2021
1 parent bb5fd81 commit c7cd7c2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cover:
go tool cover -func=coverage.out

fmt:
gofmt -w -s .
gofumpt -w -s .

lint:
golangci-lint run -c .golang-ci.yml
4 changes: 1 addition & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import (
"github.com/spf13/cobra"
)

var (
version = ""
)
var version = ""

func newRootCmd() *cobra.Command {
cmd := &cobra.Command{
Expand Down
10 changes: 4 additions & 6 deletions internal/convert/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ import (
"strconv"
)

var (
//nolint
errConvertionError = func(v interface{}) error {
return fmt.Errorf("cannot convert value %v (type %T) to integer", v, v)
}
)
//nolint
var errConvertionError = func(v interface{}) error {
return fmt.Errorf("cannot convert value %v (type %T) to integer", v, v)
}

// ToInteger converts given value to integer.
func ToInteger(v interface{}) (int, error) {
Expand Down
4 changes: 2 additions & 2 deletions scripts/gofmtcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

# Check gofmt
echo "==> Checking that code complies with gofmt requirements..."
gofmt_files=$(find . -name '*.go' | grep -v vendor | xargs gofmt -l -s)
gofmt_files=$(find . -name '*.go' | grep -v vendor | xargs gofumpt -l -s)
if [[ -n ${gofmt_files} ]]; then
echo 'gofmt needs running on the following files:'
echo "${gofmt_files}"
echo "You can use the command: \`make fmt\` to reformat code."
exit
fi

exit 0%
exit 0

0 comments on commit c7cd7c2

Please sign in to comment.