Skip to content

Commit

Permalink
lint: fix error with golanglint-ci v1.56.1
Browse files Browse the repository at this point in the history
Signed-off-by: Yadong Ding <[email protected]>
  • Loading branch information
Desiki-high committed Feb 13, 2024
1 parent 18ba01d commit 2f0d37d
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cmd/containerd-nydus-grpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func main() {
Version: version.Version,
Flags: flags.F,
HideVersion: true,
Action: func(c *cli.Context) error {
Action: func(_ *cli.Context) error {
if flags.Args.PrintVersion {
fmt.Println("Version: ", version.Version)
fmt.Println("Revision: ", version.Revision)
Expand Down
2 changes: 1 addition & 1 deletion cmd/optimizer-nri-plugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func main() {
Version: version.Version,
Flags: flags.F,
HideVersion: true,
Action: func(c *cli.Context) error {
Action: func(_ *cli.Context) error {
var (
opts []stub.Option
err error
Expand Down
2 changes: 1 addition & 1 deletion cmd/prefetchfiles-nri-plugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func main() {
Version: version.Version,
Flags: flags.Flag,
HideVersion: true,
Action: func(c *cli.Context) error {
Action: func(_ *cli.Context) error {
var (
opts []stub.Option
err error
Expand Down
2 changes: 1 addition & 1 deletion internal/logging/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const (

func GetRotateLogFileNumbers(testLogDir string, suffix string) int {
i := 0
err := filepath.Walk(testLogDir, func(fname string, fi os.FileInfo, err error) error {
err := filepath.Walk(testLogDir, func(fname string, fi os.FileInfo, _ error) error {
if !fi.IsDir() && strings.HasSuffix(fname, suffix) {
i++
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/auth/kubesecret.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (kubelistener *KubeSecretListener) SyncKubeSecrets(ctx context.Context, cli
return
}
},
UpdateFunc: func(old, new interface{}) {
UpdateFunc: func(_, new interface{}) {
key, err := cache.MetaNamespaceKeyFunc(new)
if err != nil {
logrus.WithError(err).Errorf("failed to get key for secret from cache")
Expand Down
2 changes: 1 addition & 1 deletion pkg/converter/convert_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func unpackOciTar(ctx context.Context, dst string, reader io.Reader) error {
ctx,
dst,
ds,
archive.WithConvertWhiteout(func(hdr *tar.Header, file string) (bool, error) {
archive.WithConvertWhiteout(func(_ *tar.Header, _ string) (bool, error) {
// Keep to extract all whiteout files.
return true, nil
}),
Expand Down
2 changes: 1 addition & 1 deletion pkg/daemon/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func prepareNydusServer(t *testing.T) (string, func()) {
if err == nil {
_ = os.Remove(mockSocket)
}
ts := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ts := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(200)
info := types.DaemonInfo{
ID: "testid",
Expand Down
2 changes: 1 addition & 1 deletion pkg/remote/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func New(keyChain *auth.PassKeyChain, insecure bool) *Remote {
),
),
docker.WithClient(newClient(insecure)),
docker.WithPlainHTTP(func(host string) (bool, error) {
docker.WithPlainHTTP(func(_ string) (bool, error) {
return plainHTTP, nil
}),
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/system/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func (sc *Controller) setPrefetchConfiguration() func(w http.ResponseWriter, r *
}

func (sc *Controller) describeDaemons() func(w http.ResponseWriter, r *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
return func(w http.ResponseWriter, _ *http.Request) {
info := make([]daemonInfo, 0, 10)

for _, manager := range sc.managers {
Expand Down Expand Up @@ -282,7 +282,7 @@ func (sc *Controller) describeDaemons() func(w http.ResponseWriter, r *http.Requ

// TODO: Implement me!
func (sc *Controller) getDaemonRecords() func(w http.ResponseWriter, r *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
return func(w http.ResponseWriter, _ *http.Request) {
m := newErrorMessage("not implemented")
http.Error(w, m.encode(), http.StatusNotImplemented)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/retry/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var (
DefaultAttempts = uint(10)
DefaultDelay = 100 * time.Millisecond
DefaultMaxJitter = 100 * time.Millisecond
DefaultOnRetry = func(n uint, err error) {}
DefaultOnRetry = func(_ uint, _ error) {}
DefaultRetryIf = IsRecoverable
DefaultDelayType = CombineDelay(FixedDelay, RandomDelay)
DefaultLastErrorOnly = false
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/transport/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (t FakeReference) Scope(action string) string {
func TestResolve(t *testing.T) {
var callCount int
failed := false
svr := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
svr := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
callCount++
if !failed {
fmt.Fprintf(w, "ok")
Expand Down
4 changes: 2 additions & 2 deletions snapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,13 +708,13 @@ func (o *snapshotter) workPath(id string) string {
}

func (o *snapshotter) findReferrerLayer(ctx context.Context, key string) (string, snapshots.Info, error) {
return snapshot.IterateParentSnapshots(ctx, o.ms, key, func(id string, info snapshots.Info) bool {
return snapshot.IterateParentSnapshots(ctx, o.ms, key, func(_ string, info snapshots.Info) bool {
return o.fs.CheckReferrer(ctx, info.Labels)
})
}

func (o *snapshotter) findMetaLayer(ctx context.Context, key string) (string, snapshots.Info, error) {
return snapshot.IterateParentSnapshots(ctx, o.ms, key, func(id string, i snapshots.Info) bool {
return snapshot.IterateParentSnapshots(ctx, o.ms, key, func(_ string, i snapshots.Info) bool {
return label.IsNydusMetaLayer(i.Labels)
})
}
Expand Down
2 changes: 1 addition & 1 deletion tests/converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ func buildChunkDict(t *testing.T, workDir, fsVersion string, n int) (string, str
require.Equal(t, []digest.Digest{lowerNydusBlobDigest}, blobDigests)

dictBlobPath := ""
err = filepath.WalkDir(blobDir, func(path string, entry fs.DirEntry, err error) error {
err = filepath.WalkDir(blobDir, func(path string, _ fs.DirEntry, err error) error {
require.NoError(t, err)
if path == blobDir {
return nil
Expand Down

0 comments on commit 2f0d37d

Please sign in to comment.