Skip to content

Commit dc96d07

Browse files
Copilotmdelapenya
andauthored
fix lint findings from golangci-lint v2.12.2
Co-authored-by: mdelapenya <951580+mdelapenya@users.noreply.github.com>
1 parent 1809e92 commit dc96d07

4 files changed

Lines changed: 13 additions & 8 deletions

File tree

‎config_test.go‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ import (
1313
func clearConfigEnv(t *testing.T) {
1414
t.Helper()
1515

16-
var cfg config
17-
18-
typ := reflect.TypeOf(cfg)
16+
typ := reflect.TypeFor[config]()
1917
for i := range typ.NumField() {
2018
field := typ.Field(i)
2119
if name := field.Tag.Get("env"); name != "" {

‎consts.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ const (
77
// ryukLabel is the label used to identify reaper containers.
88
ryukLabel = labelBase + ".ryuk"
99

10+
// labelValueTrue is the string value used for true labels.
11+
labelValueTrue = "true"
12+
1013
// fieldError is the log field key for errors.
1114
fieldError = "error"
1215

‎reaper.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ func (r *reaper) affectedContainers(since time.Time, args filters.Args) ([]strin
453453

454454
containerIDs := make([]string, 0, len(containers))
455455
for _, container := range containers {
456-
if container.Labels[ryukLabel] == "true" {
456+
if container.Labels[ryukLabel] == labelValueTrue {
457457
// Ignore reaper containers.
458458
r.logger.Debug("skipping reaper container", "id", container.ID)
459459
continue

‎reaper_test.go‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ var (
6363

6464
// testLabels1 is a set of unique test labels.
6565
testLabels1 = map[string]string{
66-
labelBase: "true",
66+
labelBase: labelValueTrue,
6767
labelBase + ".sessionID": testID(),
6868
labelBase + ".version": "0.1.0",
69-
labelBase + ".second": "true",
69+
labelBase + ".second": labelValueTrue,
7070
}
7171

7272
// testLabels2 is a second set of unique test labels.
7373
testLabels2 = map[string]string{
74-
labelBase: "true",
74+
labelBase: labelValueTrue,
7575
labelBase + ".sessionID": testID(),
7676
labelBase + ".version": "0.1.0",
77-
labelBase + ".first": "true",
77+
labelBase + ".first": labelValueTrue,
7878
}
7979

8080
// mockContext is a matcher that matches any context.
@@ -733,6 +733,7 @@ func TestReapContainer(t *testing.T) {
733733
cli := testClient(t)
734734

735735
ids := make([]string, 2)
736+
736737
for i, labels := range []map[string]string{testLabels1, testLabels2} {
737738
config := &container.Config{
738739
Image: testImage,
@@ -788,6 +789,7 @@ func TestReapNetwork(t *testing.T) {
788789
cli := testClient(t)
789790

790791
ids := make([]string, 2)
792+
791793
for i, labels := range []map[string]string{testLabels1, testLabels2} {
792794
resp, err := cli.NetworkCreate(ctx, testID(), network.CreateOptions{
793795
Labels: labels,
@@ -819,6 +821,7 @@ func TestReapVolume(t *testing.T) {
819821
cli := testClient(t)
820822

821823
ids := make([]string, 2)
824+
822825
for i, labels := range []map[string]string{testLabels1, testLabels2} {
823826
resp, err := cli.VolumeCreate(ctx, volume.CreateOptions{
824827
Labels: labels,
@@ -850,6 +853,7 @@ func TestReapImage(t *testing.T) {
850853
cli := testClient(t)
851854

852855
ids := make([]string, 2)
856+
853857
for i, labels := range []map[string]string{testLabels1, testLabels2} {
854858
context, err := archive.Tar("testdata", archive.Uncompressed)
855859
require.NoError(t, err)

0 commit comments

Comments
 (0)