fix: linter issue
megacheck, gosimple and unused has been deprecated and subsumed by staticcheck. And staticcheck also has been upgraded. we need to update code for the linter issue. close: #2945 Signed-off-by: Wei Fu <fuweid89@gmail.com>
This commit is contained in:
@@ -329,7 +329,7 @@ func TestBreakouts(t *testing.T) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if bytes.Compare(b, content) != 0 {
|
||||
if !bytes.Equal(b, content) {
|
||||
return errors.Errorf("content differs: expected %v, got %v", content, b)
|
||||
}
|
||||
return nil
|
||||
@@ -1179,7 +1179,7 @@ func fileEntry(name string, expected []byte, mode int) tarEntryValidator {
|
||||
if hdr.Mode != int64(mode) {
|
||||
return errors.Errorf("wrong mode %o, expected %o", hdr.Mode, mode)
|
||||
}
|
||||
if bytes.Compare(b, expected) != 0 {
|
||||
if !bytes.Equal(b, expected) {
|
||||
return errors.Errorf("different file content")
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -74,7 +74,7 @@ func tarName(p string) (string, error) {
|
||||
// in file names, it is mostly safe to replace however we must
|
||||
// check just in case
|
||||
if strings.Contains(p, "/") {
|
||||
return "", fmt.Errorf("Windows path contains forward slash: %s", p)
|
||||
return "", fmt.Errorf("windows path contains forward slash: %s", p)
|
||||
}
|
||||
|
||||
return strings.Replace(p, string(os.PathSeparator), "/", -1), nil
|
||||
@@ -130,11 +130,7 @@ func skipFile(hdr *tar.Header) bool {
|
||||
// specific or Linux-specific, this warning should be changed to an error
|
||||
// to cater for the situation where someone does manage to upload a Linux
|
||||
// image but have it tagged as Windows inadvertently.
|
||||
if strings.Contains(hdr.Name, ":") {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
return strings.Contains(hdr.Name, ":")
|
||||
}
|
||||
|
||||
// handleTarTypeBlockCharFifo is an OS-specific helper function used by
|
||||
|
||||
Reference in New Issue
Block a user