GitLab Commit is coming up on August 3-4. Learn how to innovate together using GitLab, the DevOps platform. Register for free: gitlabcommitvirtual2021.com

Commit 438188cb authored by Stefan Göbel's avatar Stefan Göbel
Browse files

Fixed `go vet` complaints

parent 952e06d3
......@@ -173,7 +173,7 @@ testall: | $(TMP_DIR)
vet: | $(TMP_DIR)
go vet -v -shadow ./...
go vet ./...
# Run snot with race detection: -----------------------------------------------------------------------------
......
......@@ -63,7 +63,7 @@ func main () (int, error) {
// Don't do anything if no snapshot IDs have been specified.
if len (subcmd.Instance ().Args ()) == 0 {
return 6, common.InvalidCommandLineError { "No snapshots to delete specified." }
return 6, common.InvalidCommandLineError { Msg: "No snapshots to delete specified." }
}
// Get the Snapshottable filesystems.
......
......@@ -38,8 +38,8 @@ func init () {
//
func main () (int, error) {
fmt.Println ("Run `snot <command> --help` to get help for the <command>.\n")
fmt.Println ("Available commands are:\n")
fmt.Print ("Run `snot <command> --help` to get help for the <command>.\n\n")
fmt.Print ("Available commands are:\n\n")
for _, subcmd := range subcmd.Instance ().Registered () {
if subcmd [0] == '-' {
......
......@@ -69,7 +69,7 @@ func main () (int, error) {
// Don't do anything if not one snapshot ID has been specified.
if len (subcmd.Instance ().Args ()) != 1 {
return 6, common.InvalidCommandLineError { "One snapshot has to be specified." }
return 6, common.InvalidCommandLineError { Msg: "One snapshot has to be specified." }
}
// Get the Snapshottable filesystems.
......
......@@ -189,7 +189,7 @@ func (bt *BtrfsTool) GetBtrfsFilesystems (filesystem ... string) ([][] string, e
filesystems = append (filesystems, fs)
fs = make ([] string, 0)
} else if len (fs) != 0 {
return filesystems, fsfinder.NoDevicesError { fs [0] }
return filesystems, fsfinder.NoDevicesError { UUID: fs [0] }
}
if btrfsLblRE.MatchString (line) {
......@@ -209,7 +209,7 @@ func (bt *BtrfsTool) GetBtrfsFilesystems (filesystem ... string) ([][] string, e
// If the line does not start with a space and doesn't match "Label: …", we don't know
// what to do. Return the current filesystem list and an error.
return filesystems, fsfinder.NoUUIDOrLabelError { line }
return filesystems, fsfinder.NoUUIDOrLabelError { Dev: line }
}
......@@ -221,7 +221,7 @@ func (bt *BtrfsTool) GetBtrfsFilesystems (filesystem ... string) ([][] string, e
// example above).
if len (fs) < 2 {
return filesystems, fsfinder.NoUUIDOrLabelError { line }
return filesystems, fsfinder.NoUUIDOrLabelError { Dev: line }
}
if btrfsDevRE.MatchString (line) {
......@@ -238,14 +238,14 @@ func (bt *BtrfsTool) GetBtrfsFilesystems (filesystem ... string) ([][] string, e
if len (fs) > 2 {
filesystems = append (filesystems, fs)
} else if len (fs) != 0 {
return filesystems, fsfinder.NoDevicesError { fs [0] }
return filesystems, fsfinder.NoDevicesError { UUID: fs [0] }
}
if err := scanner.Err () ; err != nil { return filesystems, err }
if err := command.Wait () ; err != nil { return filesystems, err }
if len (filesystem) > 0 && len (filesystems) > 1 {
return filesystems, fsfinder.MultipleMatchesError { filesystem [0] }
return filesystems, fsfinder.MultipleMatchesError { Filesystem: filesystem [0] }
}
return filesystems, nil
......
......@@ -191,7 +191,7 @@ func (pu *DefaultPathUtils) MkdirAll (path string, perm os.FileMode) ([] string,
if stat, err := os.Lstat (current) ; err == nil {
if ! stat.IsDir () {
return created, &os.PathError { "mkdir", current, syscall.ENOTDIR }
return created, &os.PathError { Op: "mkdir", Path: current, Err: syscall.ENOTDIR }
}
} else {
return created, err
......@@ -279,7 +279,7 @@ func (pu *DefaultPathUtils) RemoveEmptyTree (path string) error {
if err != nil {
return err
} else if ! stat.IsDir () {
return &os.PathError { "rmempty", path, syscall.ENOTDIR }
return &os.PathError { Op: "rmempty", Path: path, Err: syscall.ENOTDIR }
}
subs, err := ioutil.ReadDir (path)
......
......@@ -21,11 +21,11 @@ import (
//
type MetaData struct {
Created time.Time `check` // Creation time. UTC.
ID string `check` // FNV-1a 32 bit hash of the UnixNano timestamp.
Timestamp string `check` // UnixNano time (base 10 string), primary ID.
Created time.Time `type:"check"` // Creation time. UTC.
ID string `type:"check"` // FNV-1a 32 bit hash of the UnixNano time.
Timestamp string `type:"check"` // UnixNano time (base 10), primary ID.
Description string `restore` // Expanded snapshot description.
Description string `type:"restore"` // Expanded snapshot description.
}
......@@ -70,7 +70,7 @@ func (data *MetaData) MergeStored (stored MetaData) error {
for i := 0 ; i < tp.NumField () ; i ++ {
tg := tp.Field (i).Tag
tg := tp.Field (i).Tag.Get ("type")
mf := mv.Field (i)
sf := sv.Field (i)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment