Add govet/golint into Travis CI build

Fix current issues
This commit is contained in:
Andrey Smirnov
2017-03-22 00:39:27 +03:00
parent 07472bec50
commit 11d828b3b1
22 changed files with 121 additions and 111 deletions
+1 -1
View File
@@ -104,7 +104,7 @@ func StrSliceDeduplicate(s []string) []string {
// StrSlicesSubstract finds all the strings which are in l but not in r, both slices shoult be sorted
func StrSlicesSubstract(l, r []string) []string {
result := make([]string, 0)
var result []string
// pointer to left and right reflists
il, ir := 0, 0
+1 -1
View File
@@ -58,7 +58,7 @@ func (s *ListSuite) TestStrSliceDeduplicate(c *C) {
}
func (s *ListSuite) TestStrSlicesSubstract(c *C) {
empty := []string{}
empty := []string(nil)
l1 := []string{"r1", "r2", "r3", "r4"}
l2 := []string{"r1", "r3"}
l3 := []string{"r2", "r4"}
+16 -15
View File
@@ -2,22 +2,23 @@
package utils
import (
"fmt"
"os"
"golang.org/x/sys/unix"
"fmt"
"os"
"golang.org/x/sys/unix"
)
// check if directory exists and is accessible
// DirIsAccessible verifies that directory exists and is accessible
func DirIsAccessible(filename string) error {
_, err := os.Stat(filename);
if err != nil {
if ! os.IsNotExist(err) {
return fmt.Errorf("Something went wrong, %v", err)
}
} else {
if unix.Access(filename, unix.W_OK) != nil {
return fmt.Errorf("'%s' is inaccessible, check access rights", filename)
}
}
return nil
_, err := os.Stat(filename)
if err != nil {
if !os.IsNotExist(err) {
return fmt.Errorf("Something went wrong, %v", err)
}
} else {
if unix.Access(filename, unix.W_OK) != nil {
return fmt.Errorf("'%s' is inaccessible, check access rights", filename)
}
}
return nil
}