Merge pull request #105 from safing/fix/bug-and-linters

Fix bugs and linters
This commit is contained in:
Daniel 2020-11-24 16:18:31 +01:00 committed by GitHub
commit a7d123ab0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 5 deletions

17
Gopkg.lock generated
View file

@ -140,6 +140,22 @@
revision = "b65e62901fc1c0d968042419e74789f6af455eb9"
version = "v1.4.2"
[[projects]]
digest = "1:eaed935e3637c60ad9897e54ab3419c18b91775d6e3af339dec54aeefb48b8d6"
name = "github.com/hashicorp/errwrap"
packages = ["."]
pruneopts = ""
revision = "7b00e5db719c64d14dd0caaacbd13e76254d02c0"
version = "v1.1.0"
[[projects]]
digest = "1:c6e569ffa34fcd24febd3562bff0520a104d15d1a600199cb3141debf2e58c89"
name = "github.com/hashicorp/go-multierror"
packages = ["."]
pruneopts = ""
revision = "2004d9dba6b07a5b8d133209244f376680f9d472"
version = "v1.1.0"
[[projects]]
digest = "1:2f0c811248aeb64978037b357178b1593372439146bda860cb16f2c80785ea93"
name = "github.com/hashicorp/go-version"
@ -366,6 +382,7 @@
"github.com/google/renameio",
"github.com/gorilla/mux",
"github.com/gorilla/websocket",
"github.com/hashicorp/go-multierror",
"github.com/hashicorp/go-version",
"github.com/seehuhn/fortuna",
"github.com/shirou/gopsutil/host",

View file

@ -147,7 +147,7 @@ func (r *Registry) Register(keyOrPrefix string, p ValueProvider) (PushFunc, erro
func (r *Registry) Get(key string) (record.Record, error) {
provider := r.getMatchingProvider(key)
if provider == nil {
return nil, nil
return nil, database.ErrNotFound
}
records, err := provider.Get(key)

View file

@ -89,11 +89,11 @@ func TestRegistryGet(t *testing.T) {
assert.Equal(t, "p1.3", r.(*testRecord).Value)
r, err = reg.Get("p1/v4")
require.NoError(t, err)
require.Error(t, err)
assert.Nil(t, r)
r, err = reg.Get("no-provider/foo")
require.NoError(t, err)
require.Error(t, err)
assert.Nil(t, r)
}

View file

@ -3,7 +3,10 @@ package osdetail
import "errors"
var (
// ErrNotSupported is returned when an operation is not supported on the current platform.
ErrNotSupported = errors.New("not supported")
ErrNotFound = errors.New("not found")
ErrEmptyOutput = errors.New("command succeeded with empty output")
// ErrNotFound is returned when the desired data is not found.
ErrNotFound = errors.New("not found")
// ErrEmptyOutput is a special error that is returned when an operation has no error, but also returns to data.
ErrEmptyOutput = errors.New("command succeeded with empty output")
)

2
utils/osdetail/test/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
test
test.exe

Binary file not shown.