Skip to content
Myr

cmd: Fix some gometalinter complaints

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Albert Nigmatzianov · committed by Albert Nigmatzianov · parent d941496 · Browse files · 4 files+6 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+6 added−6 removed

  • other:+6 added−6 removed

4 files+6 added−6 removed

modified:cobra/cmd/helpers.go-2 removed
21 unmodified lines
22 "strings"23 "text/template"24)2526var projectPath string2726var cmdDirs = [...]string{"cmd", "cmds", "command", "commands"}27var srcPaths []string2829func init() {
112 unmodified lines
modified:cobra/cmd/init_test.go+3 added-1 removed
52 unmodified lines
53 got, err := ioutil.ReadFile(path)54 if err != nil {55 return err56 }57 ioutil.WriteFile(goldenPath, got, 0644)57 if err := ioutil.WriteFile(goldenPath, got, 0644); err != nil {58 t.Fatal("Error while updating file:", err)59 }60 }61 return compareFiles(path, goldenPath)62 }63 // Unknown file.
11 unmodified lines
modified:cobra/cmd/project_test.go+2 added-2 removed
1package cmd23import (4 "path/filepath"4 "strings"5 "testing"6)78func TestFindExistingPackage(t *testing.T) {
7 unmodified lines
16}1718func hasGoPathPrefix(path string) bool {19 for _, srcPath := range srcPaths {20 if filepath.HasPrefix(path, srcPath) {20 if strings.HasPrefix(path, srcPath) {21 return true22 }23 }24 return false
1 unmodified line
modified:cobra/cmd/project.go+1 added-1 removed
35 unmodified lines
36 er(err)37 }38 for _, srcPath := range srcPaths {39 goPath := filepath.Dir(srcPath)40 if filepath.HasPrefix(wd, goPath) {40 if strings.HasPrefix(wd, goPath) {41 p.absPath = filepath.Join(srcPath, projectName)42 break43 }44 }
138 unmodified lines