Skip to content

Commit

Permalink
reformat nolint comments
Browse files Browse the repository at this point in the history
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 <github@gone.nl>
  • Loading branch information
thaJeztah committed Jun 22, 2021
1 parent a780d6d commit fa7d162
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
6 changes: 2 additions & 4 deletions fs/du_unix.go
Expand Up @@ -41,10 +41,8 @@ type inode struct {

func newInode(stat *syscall.Stat_t) inode {
return inode{
// Dev is uint32 on darwin/bsd, uint64 on linux/solaris/freebsd
dev: uint64(stat.Dev), // nolint: unconvert
// Ino is uint32 on bsd, uint64 on darwin/linux/solaris/freebsd
ino: uint64(stat.Ino), // nolint: unconvert
dev: uint64(stat.Dev), //nolint: unconvert // dev is uint32 on darwin/bsd, uint64 on linux/solaris/freebsd
ino: uint64(stat.Ino), //nolint: unconvert // ino is uint32 on bsd, uint64 on darwin/linux/solaris/freebsd
}
}

Expand Down
4 changes: 2 additions & 2 deletions fs/du_unix_test.go
Expand Up @@ -34,7 +34,7 @@ func getBsize(root string) (int64, error) {
return 0, err
}

return int64(s.Bsize), nil // nolint: unconvert
return int64(s.Bsize), nil //nolint: unconvert
}

// getTmpAlign returns filesystem specific size alignment functions
Expand Down Expand Up @@ -92,6 +92,6 @@ func duCheck(root string) (usage int64, err error) {
if err != nil {
return 0, err
}
return blocks * blocksUnitSize, nil

return blocks * blocksUnitSize, nil
}
3 changes: 1 addition & 2 deletions fs/hardlink_unix.go
Expand Up @@ -29,6 +29,5 @@ func getLinkInfo(fi os.FileInfo) (uint64, bool) {
return 0, false
}

// Ino is uint32 on bsd, uint64 on darwin/linux/solaris
return uint64(s.Ino), !fi.IsDir() && s.Nlink > 1 // nolint: unconvert
return uint64(s.Ino), !fi.IsDir() && s.Nlink > 1 //nolint: unconvert // ino is uint32 on bsd, uint64 on darwin/linux/solaris
}
10 changes: 4 additions & 6 deletions manifest.go
Expand Up @@ -75,7 +75,7 @@ func MarshalText(w io.Writer, m *Manifest) error {
// BuildManifest creates the manifest for the given context
func BuildManifest(ctx Context) (*Manifest, error) {
resourcesByPath := map[string]Resource{}
hardlinks := newHardlinkManager()
hardLinks := newHardlinkManager()

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

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

// merge and post-process the hardlinks.
// nolint:misspell
hardlinked, err := hardlinks.Merge()
hardLinked, err := hardLinks.Merge()
if err != nil {
return nil, err
}

// nolint:misspell
for _, resource := range hardlinked {
for _, resource := range hardLinked {
resourcesByPath[resource.Path()] = resource
}

Expand Down

0 comments on commit fa7d162

Please sign in to comment.