Skip to content

Commit

Permalink
chore: Update gofmt usage (#222)
Browse files Browse the repository at this point in the history
By default `go fmt` calls `gofmt -w -l`, with the recent golangci linter
changes it seems it's not enough, and rightfully so.
It now requires the files to be formatted with `-s` flag which
simplifies code, for instance removing unnecessary type literals in
slice declarations.

Example linter fail due to unsimplified code:
https://github.com/nobl9/nobl9-go/actions/runs/11123928510/job/30908411560
  • Loading branch information
nieomylnieja authored Oct 1, 2024
1 parent 6be322f commit 925d57d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ format: format/go format/cspell
format/go:
echo "Formatting Go files..."
$(call _ensure_installed,binary,goimports)
go fmt ./...
gofmt -w -l -s .
$(BIN_DIR)/goimports -local=github.com/nobl9/sloctl -w .

## Format cspell config file.
Expand Down
1 change: 1 addition & 0 deletions cspell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ words:
- dynatrace
- endef
- gobin
- gofmt
- goimports
- golangci
- gosec
Expand Down

0 comments on commit 925d57d

Please sign in to comment.