From 72be13c3e986aaee110b8f9abc78f5afcef22727 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Tue, 30 Apr 2024 08:34:26 +0200 Subject: chore(gonf): fix go vet and staticcheck errors --- pkg/custom.go | 2 +- pkg/packages.go | 2 -- pkg/permissions.go | 2 +- pkg/triggers.go | 11 ----------- pkg/values.go | 4 ++-- stdlib/os/systemd/systemd.go | 1 - 6 files changed, 4 insertions(+), 18 deletions(-) delete mode 100644 pkg/triggers.go diff --git a/pkg/custom.go b/pkg/custom.go index acca226..9b4ca3d 100644 --- a/pkg/custom.go +++ b/pkg/custom.go @@ -31,7 +31,7 @@ func (c *CustomPromise) Resolve() { } func (c CustomPromise) Status() Status { - return c.Status() + return c.promise.Status() } func resolveCustomPromises() (status Status) { diff --git a/pkg/packages.go b/pkg/packages.go index fdce87c..bf9322c 100644 --- a/pkg/packages.go +++ b/pkg/packages.go @@ -7,7 +7,6 @@ var packages []*PackagePromise // packages management functions var packages_install_function func([]string) (Status, []string) -var packages_update_function *CommandPromise // ----- Init ------------------------------------------------------------------ func init() { @@ -17,7 +16,6 @@ func init() { // ----- Public ---------------------------------------------------------------- func SetPackagesConfiguration(install func([]string) (Status, []string), update *CommandPromise) { packages_install_function = install - packages_update_function = update } func Package(names ...string) *PackagePromise { diff --git a/pkg/permissions.go b/pkg/permissions.go index 3710e68..91287c0 100644 --- a/pkg/permissions.go +++ b/pkg/permissions.go @@ -75,7 +75,7 @@ func (p *Permissions) resolve(filename string) (Status, error) { status = REPAIRED } } else { - return BROKEN, errors.New("Unsupported operating system") + return BROKEN, errors.New("unsupported operating system") } } return status, nil diff --git a/pkg/triggers.go b/pkg/triggers.go deleted file mode 100644 index 370ab1c..0000000 --- a/pkg/triggers.go +++ /dev/null @@ -1,11 +0,0 @@ -package gonf - -type simpleTrigger struct { - fact string - status Status -} - -//type compositeTrigger struct { -// triggers []simpleTrigger -// operation Operation -//} diff --git a/pkg/values.go b/pkg/values.go index bb82787..25f31e4 100644 --- a/pkg/values.go +++ b/pkg/values.go @@ -68,13 +68,13 @@ type IntValue struct { } func (i IntValue) Bytes() []byte { - return []byte(string(i.value)) + return []byte(fmt.Sprint(i.value)) } func (i IntValue) Int() (int, error) { return i.value, nil } func (i IntValue) String() string { - return string(i.value) + return fmt.Sprint(i.value) } // ----- StringsListValue ------------------------------------------------------ diff --git a/stdlib/os/systemd/systemd.go b/stdlib/os/systemd/systemd.go index 5af1e91..8d5ec77 100644 --- a/stdlib/os/systemd/systemd.go +++ b/stdlib/os/systemd/systemd.go @@ -66,5 +66,4 @@ func systemd_service(name, state string) (gonf.Status, error) { default: return gonf.BROKEN, errors.New("unsupported systemctl operation " + state) } - return gonf.KEPT, nil } -- cgit v1.2.3