Skip to content

Commit 7da6428

Browse files
committed
fix lint
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
1 parent 0e16db6 commit 7da6428

File tree

5 files changed

+6
-9
lines changed

5 files changed

+6
-9
lines changed

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ linters:
1414
disable-all: true
1515
enable:
1616
- errcheck
17-
- exportloopref
17+
- copyloopvar
1818
- forcetypeassert
1919
- gocritic
2020
- goconst

integration/patch_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ func TestPatch(t *testing.T) {
4747
require.NoError(t, err)
4848

4949
for _, img := range images {
50-
img := img
5150
// Oracle tends to throw false positives with Trivy
5251
// See https://github.com/aquasecurity/trivy/issues/1967#issuecomment-1092987400
5352
if !reportFile && !strings.Contains(img.Image, "oracle") {

pkg/buildkit/buildkit_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ func TestArrayFile(t *testing.T) {
271271
}
272272

273273
for _, tt := range tests {
274-
tt := tt
275274
t.Run(tt.desc, func(t *testing.T) {
276275
b := ArrayFile(tt.input)
277276
assert.Equal(t, tt.expected, string(b))

pkg/pkgmgr/dpkg.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ func getDPKGStatusType(b []byte) dpkgStatusType {
101101
return DPKGStatusNone
102102
}
103103

104-
st, err := strconv.Atoi(string(b))
104+
st, err := strconv.ParseUint(string(b), 10, 32)
105105
if err != nil {
106-
st = int(DPKGStatusNone)
106+
st = uint64(DPKGStatusNone)
107107
}
108108

109109
// convert ascii digit to byte
@@ -407,12 +407,12 @@ func (dm *dpkgManager) unpackAndMergeUpdates(ctx context.Context, updates unvers
407407
`bash`, `-c`, `
408408
json_str=$PACKAGES_PRESENT
409409
update_packages=""
410-
410+
411411
while IFS=':' read -r package version; do
412412
pkg_name=$(echo "$package" | sed 's/^"\(.*\)"$/\1/')
413413
pkg_version=$(echo "$version" | sed 's/^"\(.*\)"$/\1/')
414414
latest_version=$(apt show $pkg_name 2>/dev/null | awk -F ': ' '/Version:/{print $2}')
415-
415+
416416
if [ "$latest_version" != "$pkg_version" ]; then
417417
update_packages="$update_packages $pkg_name"
418418
fi

test/e2e/plugin_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@ func TestPlugins(t *testing.T) {
2727
}
2828

2929
for _, tc := range testCases {
30-
tc := tc // capture range variable
3130
t.Run(tc.image, func(t *testing.T) {
3231
t.Parallel()
3332
_, err := runPatch(tc.image, tc.report)
3433
if err != nil {
35-
assert.Equal(t, tc.err, fmt.Errorf(err.Error()))
34+
assert.Equal(t, tc.err, fmt.Errorf("%s", err.Error()))
3635
} else {
3736
assert.Equal(t, tc.err, nil)
3837
}

0 commit comments

Comments
 (0)