Skip to content

Commit f9a136a

Browse files
authored
Merge pull request #3841 from afbjorklund/reportcard
Address the low-hanging fruit on report card
2 parents 4b0bafb + 0d6c921 commit f9a136a

File tree

9 files changed

+20
-14
lines changed

9 files changed

+20
-14
lines changed

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,12 @@ gendocs: out/docs/minikube.md
236236
fmt:
237237
@gofmt -l -s -w $(SOURCE_DIRS)
238238

239+
.PHONY: reportcard
240+
reportcard:
241+
goreportcard-cli -v
242+
# "disabling misspell on large repo..."
243+
-misspell -error $(SOURCE_DIRS)
244+
239245
.PHONY: mdlint
240246
mdlint:
241247
@$(MARKDOWNLINT) $(MINIKUBE_MARKDOWN_FILES)

cmd/drivers/hyperkit/main.go

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// +build darwin
2+
13
/*
24
Copyright 2016 The Kubernetes Authors All rights reserved.
35

cmd/minikube/cmd/env.go

+3
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ var dockerEnvCmd = &cobra.Command{
328328
exit.WithCode(exit.Unavailable, `The docker host is currently not running`)
329329
}
330330
docker, err := GetDockerActive(host)
331+
if err != nil {
332+
exit.WithError("Error getting service status", err)
333+
}
331334
if !docker {
332335
exit.WithCode(exit.Unavailable, `The docker service is currently not active`)
333336
}

pkg/gvisor/enable.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func runsc() error {
117117
return downloadFileToDest(constants.GvisorURL, dest)
118118
}
119119

120-
// downloadFileToDest downlaods the given file to the dest
120+
// downloadFileToDest downloads the given file to the dest
121121
// if something already exists at dest, first remove it
122122
func downloadFileToDest(url, dest string) error {
123123
client := &http.Client{}

pkg/minikube/console/style.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ var styles = map[string]style{
9393
"verifying-noline": {Prefix: "🤔 ", OmitNewline: true},
9494
"kubectl": {Prefix: "💗 ", LowPrefix: "+ "},
9595
"meh": {Prefix: "🙄 ", LowPrefix: "? "},
96-
"embarassed": {Prefix: "🤦 ", LowPrefix: "* "},
96+
"embarrassed": {Prefix: "🤦 ", LowPrefix: "* "},
9797
"tip": {Prefix: "💡 ", LowPrefix: "i "},
9898
"unmount": {Prefix: "🔥 ", LowPrefix: "x "},
9999
"mount-options": {Prefix: "💾 ", LowPrefix: "o "},

pkg/minikube/tunnel/registry.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (r *persistentRegistry) IsAlreadyDefinedAndRunning(tunnel *ID) (*ID, error)
7070
return nil, nil
7171
}
7272

73-
func (r *persistentRegistry) Register(tunnel *ID) error {
73+
func (r *persistentRegistry) Register(tunnel *ID) (rerr error) {
7474
glog.V(3).Infof("registering tunnel: %s", tunnel)
7575
if tunnel.Route == nil {
7676
return errors.New("tunnel.Route should not be nil")
@@ -121,7 +121,7 @@ func (r *persistentRegistry) Register(tunnel *ID) error {
121121
defer func() {
122122
err := f.Close()
123123
if err != nil {
124-
fmt.Errorf("error closing registry file: %s", err)
124+
rerr = fmt.Errorf("error closing registry file: %s", err)
125125
}
126126
}()
127127

@@ -133,7 +133,7 @@ func (r *persistentRegistry) Register(tunnel *ID) error {
133133
return nil
134134
}
135135

136-
func (r *persistentRegistry) Remove(route *Route) error {
136+
func (r *persistentRegistry) Remove(route *Route) (rerr error) {
137137
glog.V(3).Infof("removing tunnel from registry: %s", route)
138138
tunnels, err := r.List()
139139
if err != nil {
@@ -158,7 +158,7 @@ func (r *persistentRegistry) Remove(route *Route) error {
158158
defer func() {
159159
err := f.Close()
160160
if err != nil {
161-
fmt.Errorf("error closing tunnel registry file: %s", err)
161+
rerr = fmt.Errorf("error closing tunnel registry file: %s", err)
162162
}
163163
}()
164164

pkg/storage/storage_provisioner.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (p *hostPathProvisioner) Delete(volume *v1.PersistentVolume) error {
9999
return errors.New("identity annotation not found on PV")
100100
}
101101
if ann != string(p.identity) {
102-
return &controller.IgnoredError{"identity annotation on PV does not match ours"}
102+
return &controller.IgnoredError{Reason: "identity annotation on PV does not match ours"}
103103
}
104104

105105
path := path.Join(p.pvDir, volume.Name)

third_party/go9p/srv_conn.go

-3
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,6 @@ func (conn *Conn) send() {
210210
}
211211
}
212212
}
213-
214-
panic("unreached")
215213
}
216214

217215
func (conn *Conn) RemoteAddr() net.Addr {
@@ -259,5 +257,4 @@ func (srv *Srv) StartListener(l net.Listener) error {
259257

260258
srv.NewConn(c)
261259
}
262-
return nil
263260
}

third_party/go9p/ufs_linux.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ func atime(stat *syscall.Stat_t) time.Time {
1919
func isBlock(d os.FileInfo) bool {
2020
stat := d.Sys().(*syscall.Stat_t)
2121
return (stat.Mode & syscall.S_IFMT) == syscall.S_IFBLK
22-
return true
2322
}
2423

2524
// IsChar reports if the file is a character device
2625
func isChar(d os.FileInfo) bool {
2726
stat := d.Sys().(*syscall.Stat_t)
2827
return (stat.Mode & syscall.S_IFMT) == syscall.S_IFCHR
29-
return true
3028
}
3129

3230
func dir2Qid(d os.FileInfo) *Qid {
@@ -42,11 +40,11 @@ func dir2Qid(d os.FileInfo) *Qid {
4240
func dir2Dir(path string, d os.FileInfo, dotu bool, upool Users) (*Dir, error) {
4341
if r := recover(); r != nil {
4442
fmt.Print("stat failed: ", r)
45-
return nil, &os.PathError{"dir2Dir", path, nil}
43+
return nil, &os.PathError{Op: "dir2Dir", Path: path, Err: nil}
4644
}
4745
sysif := d.Sys()
4846
if sysif == nil {
49-
return nil, &os.PathError{"dir2Dir: sysif is nil", path, nil}
47+
return nil, &os.PathError{Op: "dir2Dir: sysif is nil", Path: path, Err: nil}
5048
}
5149
sysMode := sysif.(*syscall.Stat_t)
5250

0 commit comments

Comments
 (0)