Skip to content

Commit

Permalink
Merge pull request #1 from spiffe/test
Browse files Browse the repository at this point in the history
Test lint
  • Loading branch information
kfox1111 authored Oct 26, 2024
2 parents 21ca1bd + 34ffb49 commit 371a26a
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 371a26a

Please sign in to comment.