gometalinter -> golangci-lint migration (#3933)

{,scripts/}Makefile:
- Remove gometalinter, install golangci-lint.
- Remove distinction between tools and devtools.
  Just tools is enough.
- test_lint -> lint
  Migrating away from underscore separated names.
- Remove unnecessary targets.
- Drop tendermint/lint. Incompatbile with golangci-lint
  and no longer necessary anyway.
- Fix misleading message in go-mod-cache.
- New ci-target to avoid download tools twice.
- Run tests with -mod=readonly.

Port tools/gometalinter.json to .golangci.yml
Update CircleCI config accordingly.

Closes: #3896
This commit is contained in:
Alessio Treglia
2019-03-19 17:52:43 +01:00
committed by GitHub
parent faefc80769
commit cdf2b7a7c5
24 changed files with 213 additions and 131 deletions
+3 -1
View File
@@ -145,7 +145,9 @@ func fingerprintForCertificate(certBytes []byte) (string, error) {
return "", err
}
h := sha256.New()
h.Write(cert.Raw)
if _, err := h.Write(cert.Raw); err != nil {
return "", err
}
fingerprintBytes := h.Sum(nil)
var buf bytes.Buffer
for i, b := range fingerprintBytes {
+7 -7
View File
@@ -227,7 +227,7 @@ func InitializeTestLCD(t *testing.T, nValidators int, initAddrs []sdk.AccAddress
genDoc, err := tmtypes.GenesisDocFromFile(genesisFile)
require.Nil(t, err)
genDoc.Validators = nil
genDoc.SaveAs(genesisFile)
require.NoError(t, genDoc.SaveAs(genesisFile))
genTxs := []json.RawMessage{}
// append any additional (non-proposing) validators
@@ -337,7 +337,7 @@ func InitializeTestLCD(t *testing.T, nValidators int, initAddrs []sdk.AccAddress
cleanup = func() {
logger.Debug("cleaning up LCD initialization")
node.Stop()
node.Stop() //nolint:errcheck
node.Wait()
lcd.Close()
}
@@ -394,7 +394,7 @@ func startLCD(logger log.Logger, listenAddr string, cdc *codec.Codec, t *testing
if err != nil {
return nil, err
}
go tmrpc.StartHTTPServer(listener, rs.Mux, logger)
go tmrpc.StartHTTPServer(listener, rs.Mux, logger) //nolint:errcheck
return listener, nil
}
@@ -559,7 +559,7 @@ func getKeys(t *testing.T, port string) []keys.KeyOutput {
// POST /keys Create a new account locally
func doKeysPost(t *testing.T, port, name, password, mnemonic string, account int, index int) keys.KeyOutput {
pk := clientkeys.AddNewKey{name, password, mnemonic, account, index}
pk := clientkeys.NewAddNewKey(name, password, mnemonic, account, index)
req, err := cdc.MarshalJSON(pk)
require.NoError(t, err)
@@ -585,7 +585,7 @@ func getKeysSeed(t *testing.T, port string) string {
// POST /keys/{name}/recove Recover a account from a seed
func doRecoverKey(t *testing.T, port, recoverName, recoverPassword, mnemonic string, account uint32, index uint32) {
pk := clientkeys.RecoverKey{recoverPassword, mnemonic, int(account), int(index)}
pk := clientkeys.NewRecoverKey(recoverPassword, mnemonic, int(account), int(index))
req, err := cdc.MarshalJSON(pk)
require.NoError(t, err)
@@ -613,7 +613,7 @@ func getKey(t *testing.T, port, name string) keys.KeyOutput {
// PUT /keys/{name} Update the password for this account in the KMS
func updateKey(t *testing.T, port, name, oldPassword, newPassword string, fail bool) {
kr := clientkeys.UpdateKeyReq{oldPassword, newPassword}
kr := clientkeys.NewUpdateKeyReq(oldPassword, newPassword)
req, err := cdc.MarshalJSON(kr)
require.NoError(t, err)
keyEndpoint := fmt.Sprintf("/keys/%s", name)
@@ -627,7 +627,7 @@ func updateKey(t *testing.T, port, name, oldPassword, newPassword string, fail b
// DELETE /keys/{name} Remove an account
func deleteKey(t *testing.T, port, name, password string) {
dk := clientkeys.DeleteKeyReq{password}
dk := clientkeys.NewDeleteKeyReq(password)
req, err := cdc.MarshalJSON(dk)
require.NoError(t, err)
keyEndpoint := fmt.Sprintf("/keys/%s", name)