mirror of
https://github.com/safing/portbase
synced 2025-09-02 10:40:39 +00:00
Merge pull request #105 from safing/fix/bug-and-linters
Fix bugs and linters
This commit is contained in:
commit
a7d123ab0b
6 changed files with 27 additions and 5 deletions
17
Gopkg.lock
generated
17
Gopkg.lock
generated
|
@ -140,6 +140,22 @@
|
||||||
revision = "b65e62901fc1c0d968042419e74789f6af455eb9"
|
revision = "b65e62901fc1c0d968042419e74789f6af455eb9"
|
||||||
version = "v1.4.2"
|
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]]
|
[[projects]]
|
||||||
digest = "1:2f0c811248aeb64978037b357178b1593372439146bda860cb16f2c80785ea93"
|
digest = "1:2f0c811248aeb64978037b357178b1593372439146bda860cb16f2c80785ea93"
|
||||||
name = "github.com/hashicorp/go-version"
|
name = "github.com/hashicorp/go-version"
|
||||||
|
@ -366,6 +382,7 @@
|
||||||
"github.com/google/renameio",
|
"github.com/google/renameio",
|
||||||
"github.com/gorilla/mux",
|
"github.com/gorilla/mux",
|
||||||
"github.com/gorilla/websocket",
|
"github.com/gorilla/websocket",
|
||||||
|
"github.com/hashicorp/go-multierror",
|
||||||
"github.com/hashicorp/go-version",
|
"github.com/hashicorp/go-version",
|
||||||
"github.com/seehuhn/fortuna",
|
"github.com/seehuhn/fortuna",
|
||||||
"github.com/shirou/gopsutil/host",
|
"github.com/shirou/gopsutil/host",
|
||||||
|
|
|
@ -147,7 +147,7 @@ func (r *Registry) Register(keyOrPrefix string, p ValueProvider) (PushFunc, erro
|
||||||
func (r *Registry) Get(key string) (record.Record, error) {
|
func (r *Registry) Get(key string) (record.Record, error) {
|
||||||
provider := r.getMatchingProvider(key)
|
provider := r.getMatchingProvider(key)
|
||||||
if provider == nil {
|
if provider == nil {
|
||||||
return nil, nil
|
return nil, database.ErrNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
records, err := provider.Get(key)
|
records, err := provider.Get(key)
|
||||||
|
|
|
@ -89,11 +89,11 @@ func TestRegistryGet(t *testing.T) {
|
||||||
assert.Equal(t, "p1.3", r.(*testRecord).Value)
|
assert.Equal(t, "p1.3", r.(*testRecord).Value)
|
||||||
|
|
||||||
r, err = reg.Get("p1/v4")
|
r, err = reg.Get("p1/v4")
|
||||||
require.NoError(t, err)
|
require.Error(t, err)
|
||||||
assert.Nil(t, r)
|
assert.Nil(t, r)
|
||||||
|
|
||||||
r, err = reg.Get("no-provider/foo")
|
r, err = reg.Get("no-provider/foo")
|
||||||
require.NoError(t, err)
|
require.Error(t, err)
|
||||||
assert.Nil(t, r)
|
assert.Nil(t, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,10 @@ package osdetail
|
||||||
import "errors"
|
import "errors"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
// ErrNotSupported is returned when an operation is not supported on the current platform.
|
||||||
ErrNotSupported = errors.New("not supported")
|
ErrNotSupported = errors.New("not supported")
|
||||||
|
// ErrNotFound is returned when the desired data is not found.
|
||||||
ErrNotFound = errors.New("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")
|
ErrEmptyOutput = errors.New("command succeeded with empty output")
|
||||||
)
|
)
|
||||||
|
|
2
utils/osdetail/test/.gitignore
vendored
Normal file
2
utils/osdetail/test/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
test
|
||||||
|
test.exe
|
Binary file not shown.
Loading…
Add table
Reference in a new issue