From 6b5b3eacddf50ab1d8f0eeead8f81b6a65786930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 22 Feb 2022 10:36:17 +0100 Subject: [PATCH] Fix some warnings --- internal/manager/config/settings.go | 13 +++---------- internal/manager/config/settings_test.go | 3 +-- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/internal/manager/config/settings.go b/internal/manager/config/settings.go index 29fef3c5..4552d2cb 100644 --- a/internal/manager/config/settings.go +++ b/internal/manager/config/settings.go @@ -176,7 +176,7 @@ type VariableValue struct { // Platforms that use this value. Only one of "Platform" and "Platforms" may be set. Platform string `yaml:"platform,omitempty" json:"platform,omitempty"` - Platforms []string `yaml:"platforms,omitempty,flow" json:"platforms,omitempty,flow"` + Platforms []string `yaml:"platforms,omitempty,flow" json:"platforms,omitempty"` // The actual value of the variable for this audience+platform. Value string `yaml:"value" json:"value"` @@ -352,11 +352,8 @@ func (c *Conf) ExpandVariables(valueToExpand string, audience VariableAudience, } // checkVariables performs some basic checks on variable definitions. -// Note that the returned error only reflects the last-found error. -// All errors are logged, though. -func (c *Conf) checkVariables() error { - var err error - +// All errors are logged, not returned. +func (c *Conf) checkVariables() { directionNames := []string{"oneway", "twoway"} validDirections := map[string]bool{} for _, direction := range directionNames { @@ -370,7 +367,6 @@ func (c *Conf) checkVariables() error { Str("direction", variable.Direction). Strs("validChoices", directionNames). Msg("variable has invalid direction") - err = ErrBadDirection } for valueIndex, value := range variable.Values { // No platforms at all. @@ -379,7 +375,6 @@ func (c *Conf) checkVariables() error { Str("name", name). Interface("value", value). Msg("variable has a platformless value") - err = ErrMissingVariablePlatform continue } @@ -408,8 +403,6 @@ func (c *Conf) checkVariables() error { variable.Values[valueIndex] = value } } - - return err } func (c *Conf) checkDatabase() { diff --git a/internal/manager/config/settings_test.go b/internal/manager/config/settings_test.go index 2ed67ee1..423c97b1 100644 --- a/internal/manager/config/settings_test.go +++ b/internal/manager/config/settings_test.go @@ -60,8 +60,7 @@ func TestVariableValidation(t *testing.T) { } c.Variables["blender"] = platformless - err := c.checkVariables() - assert.Equal(t, ErrMissingVariablePlatform, err) + c.checkVariables() assert.Equal(t, c.Variables["blender"].Values[0].Value, "/path/to/blender") assert.Equal(t, c.Variables["blender"].Values[1].Value, "/valid/path/blender")