Skip to content

Commit c99ebd3

Browse files
committed
Enable formatters as well as linters
Currently gofmt and goimports have separate targets, which means that they are forgotten for new changes.
1 parent c67e946 commit c99ebd3

File tree

7 files changed

+23
-14
lines changed

7 files changed

+23
-14
lines changed

.golangci.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,10 @@ linters:
170170
- path: '(.+)\.go$'
171171
text: "Error return value of `.*` is not checked"
172172
linter: errcheck
173+
formatters:
174+
enable:
175+
- gofmt
176+
- goimports
177+
exclusions:
178+
paths:
179+
- third_party

cmd/minikube/cmd/config/view.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type ViewTemplate struct {
4040
var configViewCmd = &cobra.Command{
4141
Use: "view",
4242
Short: "Display values currently set in the minikube config file",
43-
Long: `Display values currently set in the minikube config file.
43+
Long: `Display values currently set in the minikube config file.
4444
The output format can be customized using the --format flag, which accepts a Go template.
4545
The config file is typically located at "~/.minikube/config/config.json".`,
4646
Run: func(_ *cobra.Command, _ []string) {

cmd/minikube/cmd/start.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ func updateDriver(driverName string) {
544544
}
545545
if errors.Is(err, auxdriver.ErrAuxDriverVersionNotinPath) {
546546
exit.Error(reason.DrvAuxNotHealthy, "Aux driver"+driverName, err)
547-
} //if failed to update but not a fatal error, log it and continue (old version might still work)
547+
} // if failed to update but not a fatal error, log it and continue (old version might still work)
548548
out.WarningT("Unable to update {{.driver}} driver: {{.error}}", out.V{"driver": driverName, "error": err})
549549
}
550550
}

pkg/minikube/assets/addons_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func mapsEqual(a, b map[string]string) bool {
4545

4646
func TestParseMapString(t *testing.T) {
4747
cases := map[string]map[string]string{
48-
"Aardvark=1,B=2,Cantaloupe=3": {"Aardvark": "1", "B": "2", "Cantaloupe": "3"},
48+
"Aardvark=1,B=2,Cantaloupe=3": {"Aardvark": "1", "B": "2", "Cantaloupe": "3"},
4949
"A=,B=2,C=": {"A": "", "B": "2", "C": ""},
5050
"": {},
5151
"malformed,good=howdy,manyequals==,": {"good": "howdy"},

pkg/minikube/assets/vm_assets.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ import (
2020
"bytes"
2121
"embed"
2222
"fmt"
23-
"text/template"
2423
"io"
2524
"os"
2625
"path"
2726
"path/filepath"
2827
"strconv"
2928
"strings"
29+
"text/template"
3030
"time"
3131

3232
"github.com/pkg/errors"

pkg/minikube/download/licenses.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ func Licenses(dir string) error {
6767
return fmt.Errorf("failed to create temporary file: %v", err)
6868
}
6969
defer func() {
70-
if err := os.Remove(tempFile.Name()); err != nil {
71-
klog.Warningf("Failed to remove temp file %s: %v", tempFile.Name(), err)
72-
}
73-
}()
70+
if err := os.Remove(tempFile.Name()); err != nil {
71+
klog.Warningf("Failed to remove temp file %s: %v", tempFile.Name(), err)
72+
}
73+
}()
7474
defer func() {
75-
if err := tempFile.Close(); err != nil {
76-
klog.Warningf("Failed to close temp file %s: %v", tempFile.Name(), err)
77-
}
78-
}()
75+
if err := tempFile.Close(); err != nil {
76+
klog.Warningf("Failed to close temp file %s: %v", tempFile.Name(), err)
77+
}
78+
}()
7979

8080
if _, err := io.Copy(tempFile, resp.Body); err != nil {
8181
return fmt.Errorf("failed to copy downloaded content from %s: %v", url, err)

pkg/minikube/tunnel/route_windows_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,13 @@ Persistent Routes:
139139
expectedRt := routingTable{
140140
routingTableLine{
141141
route: unsafeParseRoute("127.0.0.1", "10.96.0.0/12"),
142-
line: " 10.96.0.0 255.240.0.0 127.0.0.1 127.0.0.1 281",
142+
line: " 10.96.0.0 255.240.0.0" +
143+
" 127.0.0.1 127.0.0.1 281",
143144
},
144145
routingTableLine{
145146
route: unsafeParseRoute("192.168.1.2", "10.211.55.0/24"),
146-
line: " 10.211.55.0 255.255.255.0 192.168.1.2 10.211.55.3 281",
147+
line: " 10.211.55.0 255.255.255.0" +
148+
" 192.168.1.2 10.211.55.3 281",
147149
},
148150
}
149151
if !reflect.DeepEqual(rt.String(), expectedRt.String()) {

0 commit comments

Comments
 (0)