Skip to content

Makefile: make "lint" target also lint cmd/continuity module and fix linting issues#255

Merged
AkihiroSuda merged 3 commits into
containerd:mainfrom
thaJeztah:fix_lint
Oct 30, 2024
Merged

Makefile: make "lint" target also lint cmd/continuity module and fix linting issues#255
AkihiroSuda merged 3 commits into
containerd:mainfrom
thaJeztah:fix_lint

Conversation

@thaJeztah

@thaJeztah thaJeztah commented Oct 26, 2024

Copy link
Copy Markdown
Member

cmd/continuity: fix SA1019: entry.User/entry.Group is deprecated

Add nolint-comments, and a small utility to show either the user/group
name (if present), otherwise fall back to use Uid/Gid.

Before this patch:

cd cmd/continuity
go install
continuity build ./continuityfs/ > manifest.pb
continuity ls ./manifest.pb
-rw-r--r--      7.5 kB  /fuse.go
-rw-r--r--      1.7 kB  /provider.go

With this patch:

cd cmd/continuity
go install
continuity build ./continuityfs/ > manifest.pb
continuity ls ./manifest.pb
-rw-r--r--  501  20  7.5 kB  /fuse.go
-rw-r--r--  501  20  1.7 kB  /provider.go

cmd/continuity/continuityfs: SA1019: fuse.ENOENT is deprecated

Error: continuityfs/fuse.go:200:15: SA1019: fuse.ENOENT is deprecated: Return a syscall.Errno directly. See ToErrno for exact rules. (staticcheck)
        return nil, fuse.ENOENT
                    ^

Makefile: make "lint" target also lint cmd/continuity module

cmd/continuity is a separate module, and therefore was not linted.

@thaJeztah

Copy link
Copy Markdown
Member Author

Ah! Two / Three remaining; I thought I had patches for that, but probably stashed them;

Error: continuityfs/fuse.go:200:15: SA1019: fuse.ENOENT is deprecated: Return a syscall.Errno directly. See ToErrno for exact rules. (staticcheck)
		return nil, fuse.ENOENT
		            ^
Error: commands/ls.go:48:76: SA1019: entry.User is deprecated: Do not use. (staticcheck)
					fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v -> %v\n", os.FileMode(entry.Mode), entry.User, entry.Group, humanize.Bytes(uint64(entry.Size)), path, entry.Target)
					                                                                      ^
Error: commands/ls.go:51:70: SA1019: entry.User is deprecated: Do not use. (staticcheck)
					fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\n", os.FileMode(entry.Mode), entry.User, entry.Group, humanize.Bytes(uint64(entry.Size)), path)

Add nolint-comments, and a small utility to show either the user/group
name (if present), otherwise fall back to use Uid/Gid.

Before this patch:

    cd cmd/continuity
    go install
    continuity build ./continuityfs/ > manifest.pb
    continuity ls ./manifest.pb
    -rw-r--r--      7.5 kB  /fuse.go
    -rw-r--r--      1.7 kB  /provider.go

With this patch:

    cd cmd/continuity
    go install
    continuity build ./continuityfs/ > manifest.pb
    continuity ls ./manifest.pb
    -rw-r--r--  501  20  7.5 kB  /fuse.go
    -rw-r--r--  501  20  1.7 kB  /provider.go

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    Error: continuityfs/fuse.go:200:15: SA1019: fuse.ENOENT is deprecated: Return a syscall.Errno directly. See ToErrno for exact rules. (staticcheck)
            return nil, fuse.ENOENT
                        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
cmd/continuity is a separate module, and therefore was not linted.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah changed the title Makefile: make "lint" target also lint cmd/continuity module Makefile: make "lint" target also lint cmd/continuity module and fix linting issues Oct 28, 2024
@thaJeztah thaJeztah marked this pull request as ready for review October 30, 2024 00:09
@thaJeztah thaJeztah requested a review from AkihiroSuda October 30, 2024 00:09
@AkihiroSuda AkihiroSuda merged commit 163414b into containerd:main Oct 30, 2024
@thaJeztah thaJeztah deleted the fix_lint branch October 30, 2024 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants