diff --git a/fields/download.go b/fields/download.go index bc25e63..a5bdb5c 100644 --- a/fields/download.go +++ b/fields/download.go @@ -7,8 +7,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/ulikunitz/xz" - "github.com/xor-gate/ar" "io" "net/http" "net/url" @@ -18,6 +16,8 @@ import ( "strings" "github.com/iancoleman/strcase" + "github.com/ulikunitz/xz" + "github.com/xor-gate/ar" ) func DownloadAndExtract(downloadUrl url.URL, outputDir string) error { @@ -49,7 +49,7 @@ func DownloadAndExtract(downloadUrl url.URL, outputDir string) error { } } if !targetInfo.IsDir() { - return fmt.Errorf("fields info isn't a directory") + return errors.New("fields info isn't a directory") } return nil } diff --git a/fields/main.go b/fields/main.go index b55a39d..f0bd3ef 100644 --- a/fields/main.go +++ b/fields/main.go @@ -4,11 +4,12 @@ import ( _ "embed" "flag" "fmt" - log "github.com/sirupsen/logrus" "os" "path" "path/filepath" "strings" + + log "github.com/sirupsen/logrus" ) func usage() { diff --git a/fields/version.go b/fields/version.go index c411938..677a2b2 100644 --- a/fields/version.go +++ b/fields/version.go @@ -3,13 +3,15 @@ package main import ( "context" "encoding/json" + "errors" "fmt" - "github.com/hashicorp/go-version" "go/format" "net/http" "net/url" "os" "path/filepath" + + "github.com/hashicorp/go-version" ) const ( @@ -65,7 +67,7 @@ func latestUnifiVersion() (*UnifiVersion, error) { return NewUnifiVersion(firmware.Version.Core(), firmware.Links.Data.Href), nil } - return nil, nil + return nil, errors.New("no Unifi Controller firmware found") } func determineUnifiVersion(versionMarker string) (*UnifiVersion, error) {