Enable formatters as well as linters
Currently gofmt and goimports have separate targets, which means that they are forgotten for new changes.pull/21870/head
parent
c67e946d27
commit
c99ebd3d8e
|
|
@ -170,3 +170,10 @@ linters:
|
||||||
- path: '(.+)\.go$'
|
- path: '(.+)\.go$'
|
||||||
text: "Error return value of `.*` is not checked"
|
text: "Error return value of `.*` is not checked"
|
||||||
linter: errcheck
|
linter: errcheck
|
||||||
|
formatters:
|
||||||
|
enable:
|
||||||
|
- gofmt
|
||||||
|
- goimports
|
||||||
|
exclusions:
|
||||||
|
paths:
|
||||||
|
- third_party
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ type ViewTemplate struct {
|
||||||
var configViewCmd = &cobra.Command{
|
var configViewCmd = &cobra.Command{
|
||||||
Use: "view",
|
Use: "view",
|
||||||
Short: "Display values currently set in the minikube config file",
|
Short: "Display values currently set in the minikube config file",
|
||||||
Long: `Display values currently set in the minikube config file.
|
Long: `Display values currently set in the minikube config file.
|
||||||
The output format can be customized using the --format flag, which accepts a Go template.
|
The output format can be customized using the --format flag, which accepts a Go template.
|
||||||
The config file is typically located at "~/.minikube/config/config.json".`,
|
The config file is typically located at "~/.minikube/config/config.json".`,
|
||||||
Run: func(_ *cobra.Command, _ []string) {
|
Run: func(_ *cobra.Command, _ []string) {
|
||||||
|
|
|
||||||
|
|
@ -544,7 +544,7 @@ func updateDriver(driverName string) {
|
||||||
}
|
}
|
||||||
if errors.Is(err, auxdriver.ErrAuxDriverVersionNotinPath) {
|
if errors.Is(err, auxdriver.ErrAuxDriverVersionNotinPath) {
|
||||||
exit.Error(reason.DrvAuxNotHealthy, "Aux driver"+driverName, err)
|
exit.Error(reason.DrvAuxNotHealthy, "Aux driver"+driverName, err)
|
||||||
} //if failed to update but not a fatal error, log it and continue (old version might still work)
|
} // if failed to update but not a fatal error, log it and continue (old version might still work)
|
||||||
out.WarningT("Unable to update {{.driver}} driver: {{.error}}", out.V{"driver": driverName, "error": err})
|
out.WarningT("Unable to update {{.driver}} driver: {{.error}}", out.V{"driver": driverName, "error": err})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ func mapsEqual(a, b map[string]string) bool {
|
||||||
|
|
||||||
func TestParseMapString(t *testing.T) {
|
func TestParseMapString(t *testing.T) {
|
||||||
cases := map[string]map[string]string{
|
cases := map[string]map[string]string{
|
||||||
"Aardvark=1,B=2,Cantaloupe=3": {"Aardvark": "1", "B": "2", "Cantaloupe": "3"},
|
"Aardvark=1,B=2,Cantaloupe=3": {"Aardvark": "1", "B": "2", "Cantaloupe": "3"},
|
||||||
"A=,B=2,C=": {"A": "", "B": "2", "C": ""},
|
"A=,B=2,C=": {"A": "", "B": "2", "C": ""},
|
||||||
"": {},
|
"": {},
|
||||||
"malformed,good=howdy,manyequals==,": {"good": "howdy"},
|
"malformed,good=howdy,manyequals==,": {"good": "howdy"},
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,13 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"embed"
|
"embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
"text/template"
|
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
|
||||||
|
|
@ -67,15 +67,15 @@ func Licenses(dir string) error {
|
||||||
return fmt.Errorf("failed to create temporary file: %v", err)
|
return fmt.Errorf("failed to create temporary file: %v", err)
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := os.Remove(tempFile.Name()); err != nil {
|
if err := os.Remove(tempFile.Name()); err != nil {
|
||||||
klog.Warningf("Failed to remove temp file %s: %v", tempFile.Name(), err)
|
klog.Warningf("Failed to remove temp file %s: %v", tempFile.Name(), err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := tempFile.Close(); err != nil {
|
if err := tempFile.Close(); err != nil {
|
||||||
klog.Warningf("Failed to close temp file %s: %v", tempFile.Name(), err)
|
klog.Warningf("Failed to close temp file %s: %v", tempFile.Name(), err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if _, err := io.Copy(tempFile, resp.Body); err != nil {
|
if _, err := io.Copy(tempFile, resp.Body); err != nil {
|
||||||
return fmt.Errorf("failed to copy downloaded content from %s: %v", url, err)
|
return fmt.Errorf("failed to copy downloaded content from %s: %v", url, err)
|
||||||
|
|
|
||||||
|
|
@ -139,11 +139,13 @@ Persistent Routes:
|
||||||
expectedRt := routingTable{
|
expectedRt := routingTable{
|
||||||
routingTableLine{
|
routingTableLine{
|
||||||
route: unsafeParseRoute("127.0.0.1", "10.96.0.0/12"),
|
route: unsafeParseRoute("127.0.0.1", "10.96.0.0/12"),
|
||||||
line: " 10.96.0.0 255.240.0.0 127.0.0.1 127.0.0.1 281",
|
line: " 10.96.0.0 255.240.0.0" +
|
||||||
|
" 127.0.0.1 127.0.0.1 281",
|
||||||
},
|
},
|
||||||
routingTableLine{
|
routingTableLine{
|
||||||
route: unsafeParseRoute("192.168.1.2", "10.211.55.0/24"),
|
route: unsafeParseRoute("192.168.1.2", "10.211.55.0/24"),
|
||||||
line: " 10.211.55.0 255.255.255.0 192.168.1.2 10.211.55.3 281",
|
line: " 10.211.55.0 255.255.255.0" +
|
||||||
|
" 192.168.1.2 10.211.55.3 281",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(rt.String(), expectedRt.String()) {
|
if !reflect.DeepEqual(rt.String(), expectedRt.String()) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue