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 ###
- env: MODE=lint
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
- 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

View File

@ -45,7 +45,7 @@ build-dev-deps: ## Install dependencies for builds
go get github.com/mattn/goveralls
go get golang.org/x/tools/cover
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
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:
return fmt.Errorf("unhandled constraint type %q", constraintType)
}
if err != nil {
return err
}
}
return rows.Err()
}()

View File

@ -302,12 +302,9 @@ func (authDB *AuthorizationDB) UserIDs() (userIDs []string, err error) {
err = authDB.DB.Iterate(storage.IterateOptions{
Recurse: true,
}, func(iterator storage.Iterator) error {
listItem := new(storage.ListItem)
for more := true; more; {
more = iterator.Next(listItem)
if listItem != nil {
userIDs = append(userIDs, listItem.Key.String())
}
var listItem storage.ListItem
for iterator.Next(&listItem) {
userIDs = append(userIDs, listItem.Key.String())
}
return nil
})
@ -320,19 +317,13 @@ func (authDB *AuthorizationDB) List() (auths Authorizations, err error) {
Recurse: true,
}, func(iterator storage.Iterator) error {
var listErrs errs.Group
listItem := new(storage.ListItem)
for more := true; more; {
more = iterator.Next(listItem)
if listItem != nil {
var nextAuths Authorizations
if err := nextAuths.Unmarshal(listItem.Value); err != nil {
listErrs.Add(err)
}
auths = append(auths, nextAuths...)
}
if !more {
break
var listItem storage.ListItem
for iterator.Next(&listItem) {
var nextAuths Authorizations
if err := nextAuths.Unmarshal(listItem.Value); err != nil {
listErrs.Add(err)
}
auths = append(auths, nextAuths...)
}
return listErrs.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()))
}
if err != nil {
return Error.Wrap(errs.Combine(err, tx.Rollback()))
}
_, err = tx.Create_CertRecord(ctx,
dbx.CertRecord_Publickey(pubbytes),
dbx.CertRecord_Id(nodeID.Bytes()),

View File

@ -94,8 +94,8 @@ type IterateOptions struct {
// Iterator iterates over a sequence of ListItems
type Iterator interface {
// Next prepares the next list item
// returns false when you reach final item
// Next prepares the next list 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
}