Fix linter list and fix errors discovered by new staticcheck

This commit is contained in:
Andrey Smirnov
2019-01-20 00:01:17 +03:00
parent a64807efda
commit 3b5840e248
8 changed files with 9 additions and 23 deletions
+4 -6
View File
@@ -540,12 +540,10 @@ func (repo *RemoteRepo) DownloadPackageIndexes(progress aptly.Progress, d aptly.
} }
} }
err = repo.packageList.Add(p) err = repo.packageList.Add(p)
if err != nil { if _, ok := err.(*PackageConflictError); ok {
if _, ok := err.(*PackageConflictError); ok { progress.ColoredPrintf("@y[!]@| @!skipping package %s: duplicate in packages index@|", p)
progress.ColoredPrintf("@y[!]@| @!skipping package %s: duplicate in packages index@|", p) } else if err != nil {
} else { return err
return err
}
} }
} }
-1
View File
@@ -5,7 +5,6 @@ import (
) )
type VersionSuite struct { type VersionSuite struct {
stanza Stanza
} }
var _ = Suite(&VersionSuite{}) var _ = Suite(&VersionSuite{})
+3 -3
View File
@@ -81,7 +81,7 @@ func (downloader *downloaderImpl) GetLength(ctx context.Context, url string) (in
} }
if resp.ContentLength < 0 { if resp.ContentLength < 0 {
return -1, fmt.Errorf("Could not determine length of %s", url) return -1, fmt.Errorf("could not determine length of %s", url)
} }
return resp.ContentLength, nil return resp.ContentLength, nil
@@ -94,12 +94,12 @@ func (downloader *downloaderImpl) Download(ctx context.Context, url string, dest
func retryableError(err error) bool { func retryableError(err error) bool {
switch err.(type) { switch err.(type) {
case net.Error:
return true
case *net.OpError: case *net.OpError:
return true return true
case syscall.Errno: case syscall.Errno:
return true return true
case net.Error:
return true
} }
return false return false
} }
-1
View File
@@ -7,7 +7,6 @@
"deadcode", "deadcode",
"goimports", "goimports",
"misspell", "misspell",
"gosimple",
"ineffassign", "ineffassign",
"staticcheck", "staticcheck",
"varcheck", "varcheck",
+1 -2
View File
@@ -10,8 +10,7 @@ import (
) )
type GnupgSuite struct { type GnupgSuite struct {
verifier Verifier bins string
bins string
} }
var _ = Suite(&GnupgSuite{}) var _ = Suite(&GnupgSuite{})
-8
View File
@@ -119,14 +119,6 @@ func (l *lexer) backup() {
l.pos -= l.width l.pos -= l.width
} }
// peek returns but does not consume
// the next rune in the input.
func (l *lexer) peek() rune {
r := l.next()
l.backup()
return r
}
func (l *lexer) Current() item { func (l *lexer) Current() item {
if l.last.typ == 0 { if l.last.typ == 0 {
l.last = <-l.items l.last = <-l.items
-1
View File
@@ -73,7 +73,6 @@ type Server struct {
type bucket struct { type bucket struct {
name string name string
acl string acl string
ctime time.Time
objects map[string]*object objects map[string]*object
} }
+1 -1
View File
@@ -13,7 +13,7 @@ func DirIsAccessible(filename string) error {
_, err := os.Stat(filename) _, err := os.Stat(filename)
if err != nil { if err != nil {
if !os.IsNotExist(err) { if !os.IsNotExist(err) {
return fmt.Errorf("Something went wrong, %v", err) return fmt.Errorf("error checking directory '%s': %s", filename, err)
} }
} else { } else {
if unix.Access(filename, unix.W_OK) != nil { if unix.Access(filename, unix.W_OK) != nil {