cmd: Fix some gometalinter complaints

This commit is contained in:
Albert Nigmatzianov 2017-05-14 12:27:15 +02:00
parent d9414968f8
commit b5366273a6
4 changed files with 6 additions and 6 deletions

View File

@ -23,8 +23,6 @@ import (
"text/template"
)
var projectPath string
var cmdDirs = [...]string{"cmd", "cmds", "command", "commands"}
var srcPaths []string

View File

@ -54,7 +54,9 @@ func TestGoldenInitCmd(t *testing.T) {
if err != nil {
return err
}
ioutil.WriteFile(goldenPath, got, 0644)
if err := ioutil.WriteFile(goldenPath, got, 0644); err != nil {
t.Fatal("Error while updating file:", err)
}
}
return compareFiles(path, goldenPath)
}

View File

@ -37,7 +37,7 @@ func NewProject(projectName string) *Project {
}
for _, srcPath := range srcPaths {
goPath := filepath.Dir(srcPath)
if filepath.HasPrefix(wd, goPath) {
if strings.HasPrefix(wd, goPath) {
p.absPath = filepath.Join(srcPath, projectName)
break
}

View File

@ -1,7 +1,7 @@
package cmd
import (
"path/filepath"
"strings"
"testing"
)
@ -17,7 +17,7 @@ func TestFindExistingPackage(t *testing.T) {
func hasGoPathPrefix(path string) bool {
for _, srcPath := range srcPaths {
if filepath.HasPrefix(path, srcPath) {
if strings.HasPrefix(path, srcPath) {
return true
}
}