Skip to content

Commit

Permalink
fix staticcheck complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
jantari committed Jan 29, 2024
1 parent 8c26ef7 commit ac377ae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,19 +294,20 @@ func storeSecretInDatabase(key uuid.UUID, value storedSecret, updateIfExists boo
jsonData, err := json.Marshal(value)
if err != nil {
fmt.Println(err)
return err
}

err = db.Update(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte("Secrets"))
// Abort if the key already exists and update isn't set
if updateIfExists != true && b.Get(key[:]) != nil {
if !updateIfExists && b.Get(key[:]) != nil {
return errors.New("key aready exists")
}
err := b.Put(key[:], []byte(jsonData))
return err
})

return nil
return err
}

func deleteSecretFromDatabase(key uuid.UUID) error {
Expand Down

0 comments on commit ac377ae

Please sign in to comment.