Skip to content

Commit

Permalink
Fix linter list and fix errors discovered by new staticcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
smira committed Jan 19, 2019
1 parent a64807e commit 3b5840e
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 23 deletions.
10 changes: 4 additions & 6 deletions deb/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,12 +540,10 @@ func (repo *RemoteRepo) DownloadPackageIndexes(progress aptly.Progress, d aptly.
}
}
err = repo.packageList.Add(p)
if err != nil {
if _, ok := err.(*PackageConflictError); ok {
progress.ColoredPrintf("@y[!]@| @!skipping package %s: duplicate in packages index@|", p)
} else {
return err
}
if _, ok := err.(*PackageConflictError); ok {
progress.ColoredPrintf("@y[!]@| @!skipping package %s: duplicate in packages index@|", p)
} else if err != nil {
return err
}
}

Expand Down
1 change: 0 additions & 1 deletion deb/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
)

type VersionSuite struct {
stanza Stanza
}

var _ = Suite(&VersionSuite{})
Expand Down
6 changes: 3 additions & 3 deletions http/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (downloader *downloaderImpl) GetLength(ctx context.Context, url string) (in
}

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
Expand All @@ -94,12 +94,12 @@ func (downloader *downloaderImpl) Download(ctx context.Context, url string, dest

func retryableError(err error) bool {
switch err.(type) {
case net.Error:
return true
case *net.OpError:
return true
case syscall.Errno:
return true
case net.Error:
return true
}
return false
}
Expand Down
1 change: 0 additions & 1 deletion linter.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"deadcode",
"goimports",
"misspell",
"gosimple",
"ineffassign",
"staticcheck",
"varcheck",
Expand Down
3 changes: 1 addition & 2 deletions pgp/gnupg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import (
)

type GnupgSuite struct {
verifier Verifier
bins string
bins string
}

var _ = Suite(&GnupgSuite{})
Expand Down
8 changes: 0 additions & 8 deletions query/lex.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,6 @@ func (l *lexer) backup() {
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 {
if l.last.typ == 0 {
l.last = <-l.items
Expand Down
1 change: 0 additions & 1 deletion s3/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ type Server struct {
type bucket struct {
name string
acl string
ctime time.Time
objects map[string]*object
}

Expand Down
2 changes: 1 addition & 1 deletion utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func DirIsAccessible(filename string) error {
_, err := os.Stat(filename)
if err != nil {
if !os.IsNotExist(err) {
return fmt.Errorf("Something went wrong, %v", err)
return fmt.Errorf("error checking directory '%s': %s", filename, err)
}
} else {
if unix.Access(filename, unix.W_OK) != nil {
Expand Down

0 comments on commit 3b5840e

Please sign in to comment.