Merge pull request #1975 from dnephin/add-unconvert-linter

Add unconvert linter
This commit is contained in:
Michael Crosby
2018-01-10 10:54:00 -05:00
committed by GitHub
14 changed files with 42 additions and 30 deletions

View File

@@ -46,7 +46,7 @@ func parsePAXTime(s string) (time.Time, error) {
}
nsecs, _ := strconv.ParseInt(sn, 10, 64) // Must succeed
if len(ss) > 0 && ss[0] == '-' {
return time.Unix(secs, -1*int64(nsecs)), nil // Negative correction
return time.Unix(secs, -nsecs), nil // Negative correction
}
return time.Unix(secs, int64(nsecs)), nil
return time.Unix(secs, nsecs), nil
}

View File

@@ -29,11 +29,14 @@ func setHeaderForSpecialDevice(hdr *tar.Header, name string, fi os.FileInfo) err
return errors.New("unsupported stat type")
}
// Rdev is int32 on darwin/bsd, int64 on linux/solaris
rdev := uint64(s.Rdev) // nolint: unconvert
// Currently go does not fill in the major/minors
if s.Mode&syscall.S_IFBLK != 0 ||
s.Mode&syscall.S_IFCHR != 0 {
hdr.Devmajor = int64(unix.Major(uint64(s.Rdev)))
hdr.Devminor = int64(unix.Minor(uint64(s.Rdev)))
hdr.Devmajor = int64(unix.Major(rdev))
hdr.Devminor = int64(unix.Minor(rdev))
}
return nil