Skip to content

Commit

Permalink
lint: bump golangci-lint v1.61.0 and fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: Yadong Ding <[email protected]>
  • Loading branch information
Desiki-high committed Oct 15, 2024
1 parent 80b9f9c commit 4368a29
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/convert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
cache-dependency-path: "**/*.sum"
- name: Build Contrib
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/local/bin v1.54.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/local/bin v1.61.0
make -e DOCKER=false nydusify-release
- name: Upload Nydusify
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ jobs:
export NYDUS_NYDUSIFY_$version_export=/usr/bin/nydus-$version/nydusify
done
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/bin v1.54.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/bin v1.61.0
sudo -E make smoke-only
nydus-unit-test:
Expand Down
5 changes: 1 addition & 4 deletions smoke/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ linters:
- goimports
- revive
- ineffassign
- vet
- govet
- unused
- misspell
disable:
- errcheck

run:
deadline: 4m
skip-dirs:
- misc

4 changes: 2 additions & 2 deletions smoke/tests/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (b *BenchmarkTestSuite) TestBenchmark(t *testing.T) {
image = "wordpress:6.1.1"
} else {
if !tool.SupportContainerImage(tool.ImageRepo(b.t, image)) {
b.t.Fatalf("Benchmark don't support image " + image)
b.t.Fatalf("Benchmark don't support %s image ", image)
}
}
targetImageSize, conversionElapsed := b.prepareImage(b.t, ctx, image)
Expand All @@ -83,7 +83,7 @@ func (b *BenchmarkTestSuite) TestBenchmark(t *testing.T) {

// save metric
b.dumpMetric()
t.Logf(fmt.Sprintf("Metric: E2ETime %d ConversionElapsed %s ReadCount %d ReadAmount %d ImageSize %d", b.metric.E2ETime, b.metric.ConversionElapsed, b.metric.ReadCount, b.metric.ReadAmountTotal, b.metric.ImageSize))
t.Logf("Metric: E2ETime %d ConversionElapsed %s ReadCount %d ReadAmount %d ImageSize %d", b.metric.E2ETime, b.metric.ConversionElapsed, b.metric.ReadCount, b.metric.ReadAmountTotal, b.metric.ImageSize)
}

func (b *BenchmarkTestSuite) prepareImage(t *testing.T, ctx *tool.Context, image string) (int64, int64) {
Expand Down
2 changes: 1 addition & 1 deletion smoke/tests/performance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (p *PerformanceTestSuite) TestPerformance(_ *testing.T) {
image = "wordpress:6.1.1"
} else {
if !tool.SupportContainerImage(tool.ImageRepo(p.t, image)) {
p.t.Fatalf("Unsupport image " + image)
p.t.Fatalf("Unsupport %s image ", image)
}
}
// prepare test image
Expand Down
10 changes: 5 additions & 5 deletions smoke/tests/tool/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,17 @@ func RunContainerWithBaseline(t *testing.T, image string, containerName string,
runURLWaitContainer(t, image, "nydus", containerName, args)
defer ClearContainer(t, image, "nydus", containerName)
} else {
t.Fatalf(fmt.Sprintf("%s is not in URL_WAIT", image))
t.Fatalf("%s is not in URL_WAIT", image)
}
backendMetrics, err := getContainerBackendMetrics(t)
if err != nil {
t.Logf(err.Error())
t.Logf("Can't get containerd backend metrics: %s", err.Error())
}
if backendMetrics.ReadAmountTotal > uint64(float64(args.BaselineReadAmount[mode])*1.05) ||
backendMetrics.ReadCount > uint64(float64(args.BaselineReadCount[mode])*1.05) {
t.Fatalf(fmt.Sprintf("Performance reduction with ReadAmount %d and ReadCount %d", backendMetrics.ReadAmountTotal, backendMetrics.ReadCount))
t.Fatalf("Performance reduction with ReadAmount %d and ReadCount %d", backendMetrics.ReadAmountTotal, backendMetrics.ReadCount)
}
t.Logf(fmt.Sprintf("Performance Test: ReadAmount %d and ReadCount %d", backendMetrics.ReadAmountTotal, backendMetrics.ReadCount))
t.Logf("Performance Test: ReadAmount %d and ReadCount %d", backendMetrics.ReadAmountTotal, backendMetrics.ReadCount)
}

// RunContainer and return container metric
Expand All @@ -186,7 +186,7 @@ func RunContainer(t *testing.T, image string, snapshotter string, containerName
if snapshotter == "nydus" {
backendMetrics, err := getContainerBackendMetrics(t)
if err != nil {
t.Logf(err.Error())
t.Logf("Can't get containerd backend metrics: %s", err.Error())
}
containerMetric.ReadAmountTotal = backendMetrics.ReadAmountTotal
containerMetric.ReadCount = backendMetrics.ReadCount
Expand Down
2 changes: 1 addition & 1 deletion smoke/tests/tool/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ func ImageRepo(t *testing.T, image string) string {
if len(parts) > 0 {
return parts[0]
}
t.Fatalf("Can't get image repo of " + image)
t.Fatalf("Can't get %s repo", image)
return ""
}

0 comments on commit 4368a29

Please sign in to comment.