Enable mirror linter and fix findings (#13342)

* Enable mirror linter and fix findings

* Use latest version of golangci-lint

* Use v1.55.2 instead of latest

---------

Co-authored-by: terence <terence@prysmaticlabs.com>
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
Justin Traglia 2023-12-18 06:16:26 -06:00 committed by GitHub
parent d57bca97a5
commit ffe2f6b732
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 7 deletions

View File

@ -5,7 +5,7 @@ on:
branches: [ master ] branches: [ master ]
pull_request: pull_request:
branches: [ '*' ] branches: [ '*' ]
merge_group: merge_group:
types: [checks_requested] types: [checks_requested]
jobs: jobs:
@ -54,7 +54,7 @@ jobs:
- name: Golangci-lint - name: Golangci-lint
uses: golangci/golangci-lint-action@v3 uses: golangci/golangci-lint-action@v3
with: with:
version: v1.52.2 version: v1.55.2
args: --config=.golangci.yml --out-${NO_FUTURE}format colored-line-number args: --config=.golangci.yml --out-${NO_FUTURE}format colored-line-number
build: build:

View File

@ -21,6 +21,7 @@ linters:
- nilerr - nilerr
- whitespace - whitespace
- misspell - misspell
- mirror
- usestdlibvars - usestdlibvars
- errname - errname

View File

@ -137,16 +137,16 @@ func logValidatorWebAuth(validatorWebAddr, token string, tokenPath string) {
func saveAuthToken(walletDirPath string, jwtKey []byte, token string) error { func saveAuthToken(walletDirPath string, jwtKey []byte, token string) error {
hashFilePath := filepath.Join(walletDirPath, AuthTokenFileName) hashFilePath := filepath.Join(walletDirPath, AuthTokenFileName)
bytesBuf := new(bytes.Buffer) bytesBuf := new(bytes.Buffer)
if _, err := bytesBuf.Write([]byte(fmt.Sprintf("%x", jwtKey))); err != nil { if _, err := bytesBuf.WriteString(fmt.Sprintf("%x", jwtKey)); err != nil {
return err return err
} }
if _, err := bytesBuf.Write([]byte("\n")); err != nil { if _, err := bytesBuf.WriteString("\n"); err != nil {
return err return err
} }
if _, err := bytesBuf.Write([]byte(token)); err != nil { if _, err := bytesBuf.WriteString(token); err != nil {
return err return err
} }
if _, err := bytesBuf.Write([]byte("\n")); err != nil { if _, err := bytesBuf.WriteString("\n"); err != nil {
return err return err
} }
return file.WriteFile(hashFilePath, bytesBuf.Bytes()) return file.WriteFile(hashFilePath, bytesBuf.Bytes())

View File

@ -132,7 +132,7 @@ func (s *Server) ImportKeystores(w http.ResponseWriter, r *http.Request) {
} }
if req.SlashingProtection != "" { if req.SlashingProtection != "" {
if err := slashingprotection.ImportStandardProtectionJSON( if err := slashingprotection.ImportStandardProtectionJSON(
ctx, s.valDB, bytes.NewBuffer([]byte(req.SlashingProtection)), ctx, s.valDB, bytes.NewBufferString(req.SlashingProtection),
); err != nil { ); err != nil {
statuses := make([]*keymanager.KeyStatus, len(req.Keystores)) statuses := make([]*keymanager.KeyStatus, len(req.Keystores))
for i := 0; i < len(req.Keystores); i++ { for i := 0; i < len(req.Keystores); i++ {