Skip to content
Snippets Groups Projects
Verified Commit aa281558 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: update libs #11

parent e51dd8c6
No related branches found
No related tags found
No related merge requests found
...@@ -9,8 +9,8 @@ import ( ...@@ -9,8 +9,8 @@ import (
"io" "io"
"os" "os"
"github.com/pelletier/go-toml/v2" toml "github.com/pelletier/go-toml/v2"
"gopkg.in/yaml.v3" yaml "gopkg.in/yaml.v3"
) )
func (s *Settings[C]) Export() *Settings[C] { func (s *Settings[C]) Export() *Settings[C] {
...@@ -24,6 +24,7 @@ func (s *Settings[C]) writeJson(writer io.Writer) error { ...@@ -24,6 +24,7 @@ func (s *Settings[C]) writeJson(writer io.Writer) error {
func (s *Settings[C]) writeYaml(writer io.Writer) error { func (s *Settings[C]) writeYaml(writer io.Writer) error {
encoder := yaml.NewEncoder(writer) encoder := yaml.NewEncoder(writer)
return encoder.Encode(s.config) return encoder.Encode(s.config)
} }
func (s *Settings[C]) writeToml(writer io.Writer) error { func (s *Settings[C]) writeToml(writer io.Writer) error {
...@@ -65,6 +66,7 @@ func (s *Settings[C]) WriteFile(fn string, format Format) *Settings[C] { ...@@ -65,6 +66,7 @@ func (s *Settings[C]) WriteFile(fn string, format Format) *Settings[C] {
if fn == "" { if fn == "" {
file = os.Stdout file = os.Stdout
} else { } else {
// #nosec
file, err = os.Create(fn) file, err = os.Create(fn)
if err != nil { if err != nil {
s.errors = append(s.errors, err) s.errors = append(s.errors, err)
......
...@@ -10,6 +10,8 @@ import ( ...@@ -10,6 +10,8 @@ import (
type internalFS struct{} type internalFS struct{}
// Open opens a file, returning it or an error.
func (internalFS) Open(name string) (fs.File, error) { func (internalFS) Open(name string) (fs.File, error) {
// #nosec
return os.Open(name) return os.Open(name)
} }
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= 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= 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/ ...@@ -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.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 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= 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.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 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8=
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= 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 ...@@ -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/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 h1:AgsYBBmGFdhkHHx6s44ZQfTAyf/dN8U+dRTXVB+s/WI=
gitlab.schukai.com/oss/libraries/go/utilities/watch v0.3.0/go.mod h1:tMFl68peRKHgFQLltrTN3JLredofMqvGi3C0SEAj73Y= 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 h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= 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 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
......
...@@ -55,7 +55,7 @@ func (s *Settings[C]) serveGet(w http.ResponseWriter, r *http.Request) { ...@@ -55,7 +55,7 @@ func (s *Settings[C]) serveGet(w http.ResponseWriter, r *http.Request) {
return return
} }
w.Write(buf.Bytes()) _, _ = w.Write(buf.Bytes())
} }
......
...@@ -9,9 +9,9 @@ import ( ...@@ -9,9 +9,9 @@ import (
"fmt" "fmt"
"github.com/imdario/mergo" "github.com/imdario/mergo"
"github.com/magiconair/properties" "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" "gitlab.schukai.com/oss/libraries/go/utilities/pathfinder"
"gopkg.in/yaml.v3" yaml "gopkg.in/yaml.v3"
"io" "io"
"os" "os"
"path" "path"
...@@ -36,7 +36,10 @@ func importToml[C any](config *C, reader io.Reader) error { ...@@ -36,7 +36,10 @@ func importToml[C any](config *C, reader io.Reader) error {
func importProperties[C any](config *C, reader io.Reader) error { func importProperties[C any](config *C, reader io.Reader) error {
buf := &bytes.Buffer{} buf := &bytes.Buffer{}
buf.ReadFrom(reader) _, err := buf.ReadFrom(reader)
if err != nil {
return err
}
b := buf.Bytes() b := buf.Bytes()
p, err := properties.Load(b, properties.UTF8) p, err := properties.Load(b, properties.UTF8)
...@@ -169,7 +172,7 @@ func (s *Settings[C]) importFiles() { ...@@ -169,7 +172,7 @@ func (s *Settings[C]) importFiles() {
r := (io.Reader)(f) r := (io.Reader)(f)
s.importStream(reader{s.files.format, r}, func(c *C) { s.importStream(reader{s.files.format, r}, func(c *C) {
replacePath[*C](d, c) _ = replacePath[*C](d, c)
}) })
_ = f.Close() _ = f.Close()
} }
......
...@@ -14,7 +14,7 @@ func getMapForProperties[C any](c C) (map[string]string, []error) { ...@@ -14,7 +14,7 @@ func getMapForProperties[C any](c C) (map[string]string, []error) {
var errors []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() { switch field.Kind() {
case reflect.String: case reflect.String:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment