update linter to v1.16 (#1741)

* update to v1.16

* use full version number

* fix linter issues

* fix comment

* nicer comment

* restart travis

* restart travis
This commit is contained in:
Egon Elbre 2019-04-11 13:32:40 -04:00 committed by Jess G
parent bdce253c97
commit 0eee46524d
6 changed files with 13 additions and 29 deletions

View File

@ -48,7 +48,7 @@ matrix:
### run linters ### ### run linters ###
- env: MODE=lint - env: MODE=lint
install: install:
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b ${GOPATH}/bin v1.13 - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b ${GOPATH}/bin v1.16.0
# install protoc # install protoc
- curl -L https://github.com/google/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip -o /tmp/protoc.zip - curl -L https://github.com/google/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip -o /tmp/protoc.zip
- unzip /tmp/protoc.zip -d "$HOME"/protoc - unzip /tmp/protoc.zip -d "$HOME"/protoc

View File

@ -45,7 +45,7 @@ build-dev-deps: ## Install dependencies for builds
go get github.com/mattn/goveralls go get github.com/mattn/goveralls
go get golang.org/x/tools/cover go get golang.org/x/tools/cover
go get github.com/modocache/gover go get github.com/modocache/gover
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b ${GOPATH}/bin v1.10.2 curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b ${GOPATH}/bin v1.16.0
.PHONY: lint .PHONY: lint
lint: check-copyrights ## Analyze and find programs in source code lint: check-copyrights ## Analyze and find programs in source code

View File

@ -113,10 +113,6 @@ func QuerySchema(db dbschema.Queryer) (*dbschema.Schema, error) {
default: default:
return fmt.Errorf("unhandled constraint type %q", constraintType) return fmt.Errorf("unhandled constraint type %q", constraintType)
} }
if err != nil {
return err
}
} }
return rows.Err() return rows.Err()
}() }()

View File

@ -302,13 +302,10 @@ func (authDB *AuthorizationDB) UserIDs() (userIDs []string, err error) {
err = authDB.DB.Iterate(storage.IterateOptions{ err = authDB.DB.Iterate(storage.IterateOptions{
Recurse: true, Recurse: true,
}, func(iterator storage.Iterator) error { }, func(iterator storage.Iterator) error {
listItem := new(storage.ListItem) var listItem storage.ListItem
for more := true; more; { for iterator.Next(&listItem) {
more = iterator.Next(listItem)
if listItem != nil {
userIDs = append(userIDs, listItem.Key.String()) userIDs = append(userIDs, listItem.Key.String())
} }
}
return nil return nil
}) })
return userIDs, err return userIDs, err
@ -320,20 +317,14 @@ func (authDB *AuthorizationDB) List() (auths Authorizations, err error) {
Recurse: true, Recurse: true,
}, func(iterator storage.Iterator) error { }, func(iterator storage.Iterator) error {
var listErrs errs.Group var listErrs errs.Group
listItem := new(storage.ListItem) var listItem storage.ListItem
for more := true; more; { for iterator.Next(&listItem) {
more = iterator.Next(listItem)
if listItem != nil {
var nextAuths Authorizations var nextAuths Authorizations
if err := nextAuths.Unmarshal(listItem.Value); err != nil { if err := nextAuths.Unmarshal(listItem.Value); err != nil {
listErrs.Add(err) listErrs.Add(err)
} }
auths = append(auths, nextAuths...) auths = append(auths, nextAuths...)
} }
if !more {
break
}
}
return listErrs.Err() return listErrs.Err()
}) })
return auths, err return auths, err

View File

@ -32,9 +32,6 @@ func (b *certDB) SavePublicKey(ctx context.Context, nodeID storj.NodeID, publicK
return Error.Wrap(errs.Combine(err, tx.Rollback())) return Error.Wrap(errs.Combine(err, tx.Rollback()))
} }
if err != nil {
return Error.Wrap(errs.Combine(err, tx.Rollback()))
}
_, err = tx.Create_CertRecord(ctx, _, err = tx.Create_CertRecord(ctx,
dbx.CertRecord_Publickey(pubbytes), dbx.CertRecord_Publickey(pubbytes),
dbx.CertRecord_Id(nodeID.Bytes()), dbx.CertRecord_Id(nodeID.Bytes()),

View File

@ -94,8 +94,8 @@ type IterateOptions struct {
// Iterator iterates over a sequence of ListItems // Iterator iterates over a sequence of ListItems
type Iterator interface { type Iterator interface {
// Next prepares the next list item // Next prepares the next list item.
// returns false when you reach final item // It returns true on success, or false if there is no next result row or an error happened while preparing it.
Next(item *ListItem) bool Next(item *ListItem) bool
} }