mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-10 06:14:22 +00:00
Add govet/golint into Travis CI build
Fix current issues
This commit is contained in:
+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