chore(gonf): fix errcheck and shadow errors

This commit is contained in:
Julien Dessaux 2024-05-01 16:23:08 +02:00
parent 72be13c3e9
commit 8b9195e3e3
Signed by: adyxax
GPG key ID: F92E51B86E07177E
15 changed files with 65 additions and 80 deletions

View file

@ -5,15 +5,12 @@ import (
"log/slog"
)
// ----- Globals ---------------------------------------------------------------
var variables map[string]*VariablePromise
// ----- Init ------------------------------------------------------------------
func init() {
variables = make(map[string]*VariablePromise)
}
// ----- Public ----------------------------------------------------------------
func AppendVariable(name string, values ...string) *VariablePromise {
if v, ok := variables[name]; ok {
if l, ok := v.value.(*StringsListValue); ok {
@ -66,7 +63,6 @@ type VariablePromise struct {
value Value
}
// We want VariablePromise to satisfy the Value interface
func (s VariablePromise) Bytes() []byte {
return s.value.Bytes()
}
@ -77,7 +73,6 @@ func (s VariablePromise) String() string {
return s.value.String()
}
// ----- Internal --------------------------------------------------------------
func getVariable(name string) string {
if v, ok := variables[name]; ok {
return v.value.String()