Skip to content

Commit fa7d162

Browse files
committed
reformat nolint comments
Unlike comments for "humans", nolint comments should not have a leading whitespace. Also combined some comments, and renamed local variables so that we don't have to suppress linting warnings for those. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent a780d6d commit fa7d162

4 files changed

Lines changed: 9 additions & 14 deletions

File tree

fs/du_unix.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ type inode struct {
4141

4242
func newInode(stat *syscall.Stat_t) inode {
4343
return inode{
44-
// Dev is uint32 on darwin/bsd, uint64 on linux/solaris/freebsd
45-
dev: uint64(stat.Dev), // nolint: unconvert
46-
// Ino is uint32 on bsd, uint64 on darwin/linux/solaris/freebsd
47-
ino: uint64(stat.Ino), // nolint: unconvert
44+
dev: uint64(stat.Dev), //nolint: unconvert // dev is uint32 on darwin/bsd, uint64 on linux/solaris/freebsd
45+
ino: uint64(stat.Ino), //nolint: unconvert // ino is uint32 on bsd, uint64 on darwin/linux/solaris/freebsd
4846
}
4947
}
5048

fs/du_unix_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func getBsize(root string) (int64, error) {
3434
return 0, err
3535
}
3636

37-
return int64(s.Bsize), nil // nolint: unconvert
37+
return int64(s.Bsize), nil //nolint: unconvert
3838
}
3939

4040
// getTmpAlign returns filesystem specific size alignment functions
@@ -92,6 +92,6 @@ func duCheck(root string) (usage int64, err error) {
9292
if err != nil {
9393
return 0, err
9494
}
95-
return blocks * blocksUnitSize, nil
9695

96+
return blocks * blocksUnitSize, nil
9797
}

fs/hardlink_unix.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,5 @@ func getLinkInfo(fi os.FileInfo) (uint64, bool) {
2929
return 0, false
3030
}
3131

32-
// Ino is uint32 on bsd, uint64 on darwin/linux/solaris
33-
return uint64(s.Ino), !fi.IsDir() && s.Nlink > 1 // nolint: unconvert
32+
return uint64(s.Ino), !fi.IsDir() && s.Nlink > 1 //nolint: unconvert // ino is uint32 on bsd, uint64 on darwin/linux/solaris
3433
}

manifest.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func MarshalText(w io.Writer, m *Manifest) error {
7575
// BuildManifest creates the manifest for the given context
7676
func BuildManifest(ctx Context) (*Manifest, error) {
7777
resourcesByPath := map[string]Resource{}
78-
hardlinks := newHardlinkManager()
78+
hardLinks := newHardlinkManager()
7979

8080
if err := ctx.Walk(func(p string, fi os.FileInfo, err error) error {
8181
if err != nil {
@@ -97,7 +97,7 @@ func BuildManifest(ctx Context) (*Manifest, error) {
9797
}
9898

9999
// add to the hardlink manager
100-
if err := hardlinks.Add(fi, resource); err == nil {
100+
if err := hardLinks.Add(fi, resource); err == nil {
101101
// Resource has been accepted by hardlink manager so we don't add
102102
// it to the resourcesByPath until we merge at the end.
103103
return nil
@@ -114,14 +114,12 @@ func BuildManifest(ctx Context) (*Manifest, error) {
114114
}
115115

116116
// merge and post-process the hardlinks.
117-
// nolint:misspell
118-
hardlinked, err := hardlinks.Merge()
117+
hardLinked, err := hardLinks.Merge()
119118
if err != nil {
120119
return nil, err
121120
}
122121

123-
// nolint:misspell
124-
for _, resource := range hardlinked {
122+
for _, resource := range hardLinked {
125123
resourcesByPath[resource.Path()] = resource
126124
}
127125

0 commit comments

Comments
 (0)