Skip to content

Commit ed12b41

Browse files
committed
chore: update to golangci-lint v2, fix some issues
1 parent 29af1f6 commit ed12b41

3 files changed

Lines changed: 21 additions & 15 deletions

File tree

.golangci.yaml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1+
version: "2"
2+
13
linters:
24
enable:
35
- goheader
4-
5-
linters-settings:
6-
goheader:
7-
values:
8-
const:
9-
COMPANY: Cofide Limited
10-
regexp:
11-
VALID_YEAR: 202[4-9]|20[3-9][0-9]|2[1-9][0-9][0-9]
12-
# Require Cofide copyright and SPDX license in all source files.
13-
template: |-
14-
Copyright {{ VALID_YEAR }} {{ COMPANY }}.
15-
SPDX-License-Identifier: Apache-2.0
6+
settings:
7+
goheader:
8+
values:
9+
const:
10+
COMPANY: Cofide Limited
11+
regexp:
12+
VALID_YEAR: 202[4-9]|20[3-9][0-9]|2[1-9][0-9][0-9]
13+
# Require Cofide copyright and SPDX license in all source files.
14+
template: |-
15+
Copyright {{ VALID_YEAR }} {{ COMPANY }}.
16+
SPDX-License-Identifier: Apache-2.0

cmd/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ func main() {
4747
}
4848

4949
// closing client before end of run so we have a clean output
50-
client.Close()
50+
if err := client.Close(); err != nil {
51+
slog.Warn("Failed to close SPIFFE client", "error", err)
52+
}
5153

5254
displayBundles(bundles)
5355
displaySVIDs(svids, bundles)

cmd/main_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/spiffe/go-spiffe/v2/spiffeid"
2424
"github.com/spiffe/go-spiffe/v2/svid/x509svid"
2525
"github.com/stretchr/testify/assert"
26+
"github.com/stretchr/testify/require"
2627
)
2728

2829
const testCert = `-----BEGIN CERTIFICATE-----
@@ -463,11 +464,13 @@ func captureOutput(t *testing.T, fn func()) string {
463464

464465
fn()
465466

466-
w.Close()
467+
err := w.Close()
468+
require.NoError(t, err)
469+
467470
os.Stdout = old
468471

469472
var buf bytes.Buffer
470-
_, err := io.Copy(&buf, r)
473+
_, err = io.Copy(&buf, r)
471474
if err != nil {
472475
t.Fatalf("Failed to copy output: %v", err)
473476
}

0 commit comments

Comments
 (0)