Skip to content

Commit

Permalink
Test lint
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Fox <Kevin.Fox@pnnl.gov>
  • Loading branch information
kfox1111 committed Oct 26, 2024
1 parent 21ca1bd commit 34ffb49
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ func updateConfig(url string, cas string, source string, dest string) {
urlFound := false
var config yaml.Node
var caRef *yaml.Node
yaml.Unmarshal(b, &config)
err = yaml.Unmarshal(b, &config)
if err != nil {
log.Fatalf("Problem unmarshaling config: %v", err)
}
for _, d := range config.Content {
jwtFound := false
for _, j := range d.Content {
Expand Down Expand Up @@ -148,8 +151,15 @@ func updateConfig(url string, cas string, source string, dest string) {
if err != nil {
log.Fatalf("Problem creating file: %v", err)
}
yaml.NewEncoder(f).Encode(config.Content[0])
enc := yaml.NewEncoder(f)
err = enc.Encode(config.Content[0])
if err != nil {
log.Fatalf("Failed to encode content: %v", err)
}
name := f.Name()
f.Close()
os.Rename(name, dest)
err = os.Rename(name, dest)
if err != nil {
log.Fatalf("Failed to rename file into place: %v", err)
}
}

0 comments on commit 34ffb49

Please sign in to comment.