From aa281558a2ff5dd21e19524eac38b67833bfd9ec Mon Sep 17 00:00:00 2001
From: Volker Schukai <volker.schukai@schukai.com>
Date: Sat, 28 Oct 2023 15:03:34 +0200
Subject: [PATCH] fix: update libs #11

---
 export.go       |  6 ++++--
 filesystem.go   |  2 ++
 go.sum          |  8 --------
 http-handler.go |  2 +-
 import.go       | 11 +++++++----
 properties.go   |  2 +-
 6 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/export.go b/export.go
index 9f2424d..e0259d7 100644
--- a/export.go
+++ b/export.go
@@ -9,8 +9,8 @@ import (
 	"io"
 	"os"
 
-	"github.com/pelletier/go-toml/v2"
-	"gopkg.in/yaml.v3"
+	toml "github.com/pelletier/go-toml/v2"
+	yaml "gopkg.in/yaml.v3"
 )
 
 func (s *Settings[C]) Export() *Settings[C] {
@@ -24,6 +24,7 @@ func (s *Settings[C]) writeJson(writer io.Writer) error {
 
 func (s *Settings[C]) writeYaml(writer io.Writer) error {
 	encoder := yaml.NewEncoder(writer)
+
 	return encoder.Encode(s.config)
 }
 func (s *Settings[C]) writeToml(writer io.Writer) error {
@@ -65,6 +66,7 @@ func (s *Settings[C]) WriteFile(fn string, format Format) *Settings[C] {
 	if fn == "" {
 		file = os.Stdout
 	} else {
+		// #nosec
 		file, err = os.Create(fn)
 		if err != nil {
 			s.errors = append(s.errors, err)
diff --git a/filesystem.go b/filesystem.go
index 9cf5b95..e352318 100644
--- a/filesystem.go
+++ b/filesystem.go
@@ -10,6 +10,8 @@ import (
 
 type internalFS struct{}
 
+// Open opens a file, returning it or an error.
 func (internalFS) Open(name string) (fs.File, error) {
+	// #nosec
 	return os.Open(name)
 }
diff --git a/go.sum b/go.sum
index 143de74..cf5fa75 100644
--- a/go.sum
+++ b/go.sum
@@ -1,8 +1,6 @@
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
-github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
 github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
 github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
 github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
@@ -26,7 +24,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
 github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
 github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
 github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
-github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU=
 github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc=
 github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8=
 github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
@@ -38,13 +35,8 @@ gitlab.schukai.com/oss/libraries/go/utilities/pathfinder v0.9.1 h1:WpM6PcFqQZWPB
 gitlab.schukai.com/oss/libraries/go/utilities/pathfinder v0.9.1/go.mod h1:MqCBFv7DXKoBE2rZDc51LGvl2QI7Kz0D+XkQ0izj+ws=
 gitlab.schukai.com/oss/libraries/go/utilities/watch v0.3.0 h1:AgsYBBmGFdhkHHx6s44ZQfTAyf/dN8U+dRTXVB+s/WI=
 gitlab.schukai.com/oss/libraries/go/utilities/watch v0.3.0/go.mod h1:tMFl68peRKHgFQLltrTN3JLredofMqvGi3C0SEAj73Y=
-golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
-golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
 golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
 golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
-golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
-golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
 golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
diff --git a/http-handler.go b/http-handler.go
index b7c2b71..6c6c097 100644
--- a/http-handler.go
+++ b/http-handler.go
@@ -55,7 +55,7 @@ func (s *Settings[C]) serveGet(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	w.Write(buf.Bytes())
+	_, _ = w.Write(buf.Bytes())
 
 }
 
diff --git a/import.go b/import.go
index 3139764..b703b8b 100644
--- a/import.go
+++ b/import.go
@@ -9,9 +9,9 @@ import (
 	"fmt"
 	"github.com/imdario/mergo"
 	"github.com/magiconair/properties"
-	"github.com/pelletier/go-toml/v2"
+	toml "github.com/pelletier/go-toml/v2"
 	"gitlab.schukai.com/oss/libraries/go/utilities/pathfinder"
-	"gopkg.in/yaml.v3"
+	yaml "gopkg.in/yaml.v3"
 	"io"
 	"os"
 	"path"
@@ -36,7 +36,10 @@ func importToml[C any](config *C, reader io.Reader) error {
 func importProperties[C any](config *C, reader io.Reader) error {
 
 	buf := &bytes.Buffer{}
-	buf.ReadFrom(reader)
+	_, err := buf.ReadFrom(reader)
+	if err != nil {
+		return err
+	}
 	b := buf.Bytes()
 
 	p, err := properties.Load(b, properties.UTF8)
@@ -169,7 +172,7 @@ func (s *Settings[C]) importFiles() {
 
 		r := (io.Reader)(f)
 		s.importStream(reader{s.files.format, r}, func(c *C) {
-			replacePath[*C](d, c)
+			_ = replacePath[*C](d, c)
 		})
 		_ = f.Close()
 	}
diff --git a/properties.go b/properties.go
index 17a337c..8badea0 100644
--- a/properties.go
+++ b/properties.go
@@ -14,7 +14,7 @@ func getMapForProperties[C any](c C) (map[string]string, []error) {
 
 	var errors []error
 
-	runOnTags(c, []string{"properties"}, func(tagValue string, field reflect.Value) {
+	_ = runOnTags(c, []string{"properties"}, func(tagValue string, field reflect.Value) {
 
 		switch field.Kind() {
 		case reflect.String:
-- 
GitLab