Skip to content

Commit aad9b31

Browse files
authored
update dependencies (#46)
* update dependencies
1 parent f22719a commit aad9b31

File tree

15 files changed

+154
-66
lines changed

15 files changed

+154
-66
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ jobs:
5353
go-version: 1.23
5454
- uses: actions/checkout@v4
5555
- name: golangci-lint
56-
uses: golangci/golangci-lint-action@v6
56+
uses: golangci/golangci-lint-action@v8

.github/workflows/pushimage.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ jobs:
2222
password: ${{ secrets.GITHUB_TOKEN }}
2323

2424
- name: Build and push Docker image
25-
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4
25+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
2626
with:
2727
push: true
2828
tags: ghcr.io/tlinden/anydb:${{ github.ref_name}}
2929

3030
- name: Build and push latest Docker image
31-
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4
31+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
3232
with:
3333
push: true
3434
tags: ghcr.io/tlinden/anydb:latest

.golangci.bck.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
linters:
2+
exclusions:
3+
rules:
4+
- linters:
5+
- staticcheck
6+
text: "QF1008:"

.golangci.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: "2"
2+
linters:
3+
exclusions:
4+
rules:
5+
- linters:
6+
- staticcheck
7+
text: "QF1008:"

app/db.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"encoding/json"
2121
"errors"
2222
"fmt"
23+
"log"
2324
"log/slog"
2425
"os"
2526
"path/filepath"
@@ -115,8 +116,10 @@ func (db *DB) Open() error {
115116
return nil
116117
}
117118

118-
func (db *DB) Close() error {
119-
return db.DB.Close()
119+
func (db *DB) Close() {
120+
if err := db.DB.Close(); err != nil {
121+
log.Fatal(err)
122+
}
120123
}
121124

122125
func (db *DB) List(attr *DbAttr, fulltext bool) (DbEntries, error) {
@@ -242,14 +245,14 @@ func (db *DB) Set(attr *DbAttr) error {
242245
return err
243246
}
244247
}
245-
248+
246249
if oldentry != nil {
247250
if len(oldentry.Tags) > 0 && len(entry.Tags) == 0 {
248251
// initialize update entry with tags from old entry
249252
entry.Tags = oldentry.Tags
250253
}
251254
}
252-
255+
253256
slog.Debug("+++ MARSHAL")
254257
// marshall our data
255258
pbentry, err := proto.Marshal(&entry)
@@ -304,7 +307,7 @@ func (db *DB) Set(attr *DbAttr) error {
304307
// internal DB getter, assumes db.DB has already been
305308
// opened successfully. Do NOT call this w/o valid
306309
// DB handle!
307-
func (db *DB)txGet(attr *DbAttr) (*DbEntry, error) {
310+
func (db *DB) txGet(attr *DbAttr) (*DbEntry, error) {
308311
entry := DbEntry{}
309312

310313
err := db.DB.View(func(tx *bolt.Tx) error {

app/io.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ import "os"
2020

2121
func cleanError(file string, err error) error {
2222
// remove given [backup] file and forward the given error
23-
os.Remove(file)
24-
return err
23+
return os.Remove(file)
2524
}
2625

2726
func fileExists(filename string) bool {

cfg/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright © 2024 Thomas von Dein
2+
Copyright © 2025 Thomas von Dein
33
44
This program is free software: you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ import (
2626
"github.com/tlinden/anydb/common"
2727
)
2828

29-
var Version string = "v0.2.2"
29+
var Version string = "v0.2.3"
3030

3131
type BucketConfig struct {
3232
Encrypt bool

cmd/crud.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func Del(conf *cfg.Config) *cobra.Command {
156156
Long: `Delete key and value matching key`,
157157
RunE: func(cmd *cobra.Command, args []string) error {
158158
if len(args) == 0 {
159-
return errors.New("No key specified")
159+
return errors.New("no key specified")
160160
}
161161

162162
// errors at this stage do not cause the usage to be shown

cmd/extra.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"errors"
2222
"fmt"
2323
"io"
24+
"log"
2425
"os"
2526
"os/exec"
2627

@@ -285,7 +286,11 @@ func editContent(editor string, content string) (string, error) {
285286
if err != nil {
286287
return "", fmt.Errorf("failed to create templ file: %w", err)
287288
}
288-
defer os.Remove(tmp.Name())
289+
defer func() {
290+
if err := os.Remove(tmp.Name()); err != nil {
291+
log.Fatal(err)
292+
}
293+
}()
289294

290295
// put the content into a tmp file
291296
_, err = tmp.WriteString(content)
@@ -310,7 +315,11 @@ func editContent(editor string, content string) (string, error) {
310315
if err != nil {
311316
return "", fmt.Errorf("failed to open temp file: %w", err)
312317
}
313-
defer modified.Close()
318+
defer func() {
319+
if err := modified.Close(); err != nil {
320+
log.Fatal(err)
321+
}
322+
}()
314323

315324
newcontent, err := io.ReadAll(modified)
316325
if err != nil {

common/io.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ import "os"
2020

2121
func CleanError(file string, err error) error {
2222
// remove given [backup] file and forward the given error
23-
os.Remove(file)
24-
return err
23+
return os.Remove(file)
2524
}
2625

2726
func FileExists(filename string) bool {

0 commit comments

Comments
 (0)