Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Configuration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSS
Libraries
Go
Application
Configuration
Commits
aa281558
Verified
Commit
aa281558
authored
1 year ago
by
Volker Schukai
Browse files
Options
Downloads
Patches
Plain Diff
fix: update libs
#11
parent
e51dd8c6
No related branches found
No related tags found
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
export.go
+4
-2
4 additions, 2 deletions
export.go
filesystem.go
+2
-0
2 additions, 0 deletions
filesystem.go
go.sum
+0
-8
0 additions, 8 deletions
go.sum
http-handler.go
+1
-1
1 addition, 1 deletion
http-handler.go
import.go
+7
-4
7 additions, 4 deletions
import.go
properties.go
+1
-1
1 addition, 1 deletion
properties.go
with
15 additions
and
16 deletions
export.go
+
4
−
2
View file @
aa281558
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
filesystem.go
+
2
−
0
View file @
aa281558
...
...
@@ -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
)
}
This diff is collapsed.
Click to expand it.
go.sum
+
0
−
8
View file @
aa281558
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=
...
...
This diff is collapsed.
Click to expand it.
http-handler.go
+
1
−
1
View file @
aa281558
...
...
@@ -55,7 +55,7 @@ func (s *Settings[C]) serveGet(w http.ResponseWriter, r *http.Request) {
return
}
w
.
Write
(
buf
.
Bytes
())
_
,
_
=
w
.
Write
(
buf
.
Bytes
())
}
...
...
This diff is collapsed.
Click to expand it.
import.go
+
7
−
4
View file @
aa281558
...
...
@@ -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
()
}
...
...
This diff is collapsed.
Click to expand it.
properties.go
+
1
−
1
View file @
aa281558
...
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment