linter: add metalinter to Makefile & apply some fixes

This commit is contained in:
Zach Ramsay
2017-10-04 17:53:56 -04:00
parent 0418d32276
commit fe66a683bc
13 changed files with 65 additions and 131 deletions
+2
View File
@@ -25,11 +25,13 @@ func New(coder Encoder, store keys.Storage, codec keys.Codec) Manager {
}
// exists just to make sure we fulfill the Signer interface
// nolint [ megacheck, deadcode ]
func (s Manager) assertSigner() keys.Signer {
return s
}
// exists just to make sure we fulfill the Manager interface
// nolint [ megacheck, deadcode ]
func (s Manager) assertKeyManager() keys.Manager {
return s
}
+3 -1
View File
@@ -5,6 +5,8 @@ for key management, transaction signing, and query validation.
Please read the README and godoc to see how to
configure the server for your application.
*/
// nolint: goimports
package server
import (
@@ -12,8 +14,8 @@ import (
"io/ioutil"
"net/http"
data "github.com/tendermint/go-wire/data"
"github.com/tendermint/go-crypto/keys/server/types"
data "github.com/tendermint/go-wire/data"
"github.com/pkg/errors"
)
+3 -2
View File
@@ -22,8 +22,8 @@ const (
PrivExt = "tlc"
PubExt = "pub"
keyPerm = os.FileMode(0600)
pubPerm = os.FileMode(0644)
dirPerm = os.FileMode(0700)
// pubPerm = os.FileMode(0644)
dirPerm = os.FileMode(0700)
)
type FileStore struct {
@@ -43,6 +43,7 @@ func New(dir string) FileStore {
}
// assertStorage just makes sure we implement the proper Storage interface
// nolint [ megacheck, deadcode ]
func (s FileStore) assertStorage() keys.Storage {
return s
}
+1
View File
@@ -23,6 +23,7 @@ func New() MemStore {
}
// assertStorage just makes sure we implement the Storage interface
// nolint [ megacheck, deadcode ]
func (s MemStore) assertStorage() keys.Storage {
return s
}
+2 -2
View File
@@ -119,8 +119,8 @@ func TestCheckInvalidLists(t *testing.T) {
w, err := codec.BytesToWords(data)
if tc.valid {
assert.Nil(err, "%d: %+v", i, err)
b, err := codec.WordsToBytes(w)
assert.Nil(err, "%d: %+v", i, err)
b, err1 := codec.WordsToBytes(w)
assert.Nil(err1, "%d: %+v", i, err1)
assert.Equal(data, b)
} else {
assert.NotNil(err, "%d", i)
+8 -7
View File
@@ -6,6 +6,7 @@
// keys/wordlist/spanish.txt
// DO NOT EDIT!
// nolint: goimports
package wordlist
import (
@@ -204,9 +205,9 @@ func AssetNames() []string {
// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){
"keys/wordlist/chinese_simplified.txt": keysWordlistChinese_simplifiedTxt,
"keys/wordlist/english.txt": keysWordlistEnglishTxt,
"keys/wordlist/japanese.txt": keysWordlistJapaneseTxt,
"keys/wordlist/spanish.txt": keysWordlistSpanishTxt,
"keys/wordlist/english.txt": keysWordlistEnglishTxt,
"keys/wordlist/japanese.txt": keysWordlistJapaneseTxt,
"keys/wordlist/spanish.txt": keysWordlistSpanishTxt,
}
// AssetDir returns the file names below a certain
@@ -248,13 +249,14 @@ type bintree struct {
Func func() (*asset, error)
Children map[string]*bintree
}
var _bintree = &bintree{nil, map[string]*bintree{
"keys": &bintree{nil, map[string]*bintree{
"wordlist": &bintree{nil, map[string]*bintree{
"chinese_simplified.txt": &bintree{keysWordlistChinese_simplifiedTxt, map[string]*bintree{}},
"english.txt": &bintree{keysWordlistEnglishTxt, map[string]*bintree{}},
"japanese.txt": &bintree{keysWordlistJapaneseTxt, map[string]*bintree{}},
"spanish.txt": &bintree{keysWordlistSpanishTxt, map[string]*bintree{}},
"english.txt": &bintree{keysWordlistEnglishTxt, map[string]*bintree{}},
"japanese.txt": &bintree{keysWordlistJapaneseTxt, map[string]*bintree{}},
"spanish.txt": &bintree{keysWordlistSpanishTxt, map[string]*bintree{}},
}},
}},
}}
@@ -305,4 +307,3 @@ func _filePath(dir, name string) string {
cannonicalName := strings.Replace(name, "\\", "/", -1)
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
}