Add golangci-lint run to lib/ (#181)

* [lib] Add .golangci.yaml as symlink

https://github.com/golang/go/wiki/Modules#faqs--multi-module-repositories

* [golangci-lint] Change `nakedret` settings

* [linter] Can be replaced with faster hex.EncodeToString (perfsprint)

* [linter] Fix too many quotes

* [ci] Add `golangci-lint run` of `lib/`

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
This commit is contained in:
Julian Strobl 2023-11-16 09:16:56 +01:00 committed by GitHub
parent dbd8e07a72
commit e36eb6c2a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 3 deletions

View File

@ -56,7 +56,7 @@ jobs:
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- name: Run golangci-lint
run: golangci-lint run
run: (golangci-lint run && cd lib && golangci-lint run)
- name: Run tests
run: go test -race -vet=off ./...

View File

@ -66,6 +66,9 @@ linters:
- usestdlibvars
- wastedassign
- zerologlint
linters-settings:
nakedret:
max-func-lines: 100
issues:
exclude-rules:
- path: codec\.go

1
lib/.golangci.yaml Symbolic link
View File

@ -0,0 +1 @@
../.golangci.yaml

View File

@ -10,7 +10,7 @@ import (
// Config defines library top level configuration.
type Config struct {
ChainID string `mapstructure:"chain-id" json:"chain-id"`
EncodingConfig params.EncodingConfig `mapstructure:"encoding-config" json:"encoding-config""`
EncodingConfig params.EncodingConfig `mapstructure:"encoding-config" json:"encoding-config"`
RootDir string `mapstructure:"root-dir" json:"root-dir"`
RPCEndpoint string `mapstructure:"rpc-endpoint" json:"rpc-endpoint"`
}

View File

@ -50,7 +50,7 @@ func getKeyPairFromKeyring(address sdk.AccAddress) (keyPair KeyPair, err error)
return
}
name := fmt.Sprintf("%x", []byte(address)) + ".address"
name := hex.EncodeToString([]byte(address)) + ".address"
i, err := ring.Get(name)
if err != nil {
return