mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-09 06:04:12 +00:00
Add govet/golint into Travis CI build
Fix current issues
This commit is contained in:
+1
-1
@@ -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
@@ -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
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user