summaryrefslogtreecommitdiff
path: root/pkg/users.go
diff options
context:
space:
mode:
authorJulien Dessaux2024-05-01 16:23:08 +0200
committerJulien Dessaux2024-05-01 16:23:08 +0200
commit8b9195e3e3506d576b39a23ca646c260dfacc808 (patch)
tree1cdbdd2fb368654ef8eab702258eb5d6a90e1447 /pkg/users.go
parentchore(gonf): fix go vet and staticcheck errors (diff)
downloadgonf-8b9195e3e3506d576b39a23ca646c260dfacc808.tar.gz
gonf-8b9195e3e3506d576b39a23ca646c260dfacc808.tar.bz2
gonf-8b9195e3e3506d576b39a23ca646c260dfacc808.zip
chore(gonf): fix errcheck and shadow errors
Diffstat (limited to '')
-rw-r--r--pkg/users.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/pkg/users.go b/pkg/users.go
index ca7913b..2577207 100644
--- a/pkg/users.go
+++ b/pkg/users.go
@@ -4,20 +4,16 @@ import (
"log/slog"
)
-// ----- Globals ---------------------------------------------------------------
var users []*UserPromise
-// users management functions
-var user_add_function func(data UserData) (Status, error)
+var userAddFunction func(data UserData) (Status, error)
-// ----- Init ------------------------------------------------------------------
func init() {
users = make([]*UserPromise, 0)
}
-// ----- Public ----------------------------------------------------------------
func SetUsersConfiguration(useradd func(data UserData) (Status, error)) {
- user_add_function = useradd
+ userAddFunction = useradd
}
func User(data UserData) *UserPromise {
@@ -57,7 +53,7 @@ func (u *UserPromise) Promise() Promise {
func (u *UserPromise) Resolve() {
var err error
- u.status, err = user_add_function(u.data)
+ u.status, err = userAddFunction(u.data)
switch u.status {
case BROKEN:
slog.Error("user", "name", u.data.Name, "status", u.status, "error", err)
@@ -77,7 +73,6 @@ func (u UserPromise) Status() Status {
return u.status
}
-// ----- Internal --------------------------------------------------------------
func resolveUsers() (status Status) {
status = KEPT
for _, c := range users {