Code Quality: Add "gofmt -w -s pkg internal cmd" to "make fmt-go"

gofmt formats Go source code, where -s stands for "simplify"
This commit is contained in:
Michael Mayer 2022-01-08 12:12:00 +01:00
parent 4ef85fb515
commit 006b5bb704
6 changed files with 7 additions and 6 deletions

View file

@ -252,6 +252,7 @@ fmt-js:
(cd frontend && npm run fmt)
fmt-go:
go fmt ./pkg/... ./internal/... ./cmd/...
gofmt -w -s pkg internal cmd
goimports -w pkg internal cmd
tidy:
go mod tidy

View file

@ -108,7 +108,7 @@ func getPassword(prompt string) string {
signalChannel := make(chan os.Signal, 1)
signal.Notify(signalChannel, os.Interrupt)
go func() {
for _ = range signalChannel {
for range signalChannel {
fmt.Println("")
termEcho(true)
os.Exit(1)

View file

@ -229,7 +229,7 @@ func MomentsStates(threshold int) (results Moments, err error) {
func MomentsLabels(threshold int) (results Moments, err error) {
var cats []string
for cat, _ := range MomentLabels {
for cat := range MomentLabels {
cats = append(cats, cat)
}

View file

@ -79,7 +79,7 @@ var (
s, t float64
)
for i, _ := range a {
for i := range a {
t = a[i] - b[i]
s += t * t
}
@ -93,7 +93,7 @@ var (
s, t float64
)
for i, _ := range a {
for i := range a {
t = a[i] - b[i]
s += t * t
}

View file

@ -34,7 +34,7 @@ func (i *jsonImporter) Import(file string, start, end int) ([][]float64, error)
return [][]float64{}, err
}
for i, _ := range d {
for i := range d {
c = 0
for j := start; j <= end; j++ {

View file

@ -57,7 +57,7 @@ func FileTitle(s string) string {
title = strings.ReplaceAll(title, " ", " ")
// Remove small words from title ending.
for w, _ := range SmallWords {
for w := range SmallWords {
title = strings.TrimSuffix(title, " "+w)
}