ci: Fix linter complaint (backport #9645) (#9647)

* ci: Fix linter complaint (#9645)

Fixes a very silly linter complaint that makes absolutely no sense and is blocking the merging of several PRs.

---

#### PR checklist

- [x] Tests written/updated, or no tests needed
- [x] `CHANGELOG_PENDING.md` updated, or no changelog entry needed
- [x] Updated relevant documentation (`docs/`) and code comments, or no
      documentation updates needed

(cherry picked from commit 83b7f4ad5b)

# Conflicts:
#	.github/workflows/lint.yml
#	.golangci.yml
#	cmd/tendermint/commands/debug/util.go

* Resolve conflicts

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* ci: Sync golangci-lint config with main

Minus the spelling configuration that restricts spelling to US English
only.

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* make format

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* Remove usage of deprecated io/ioutil package

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* Remove unused mockBlockStore

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* blockchain/v2: Remove unused method

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* Bulk fix lints

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* lint: Ignore auto-generated query PEG

Signed-off-by: Thane Thomson <connect@thanethomson.com>

Signed-off-by: Thane Thomson <connect@thanethomson.com>
Co-authored-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
mergify[bot]
2022-10-29 08:58:18 -04:00
committed by GitHub
co-authored by Thane Thomson
parent a6dd0d270a
commit e914fe40ec
93 changed files with 425 additions and 476 deletions
+2 -1
View File
@@ -1,4 +1,3 @@
// nolint: gosec
package main
import (
@@ -10,6 +9,7 @@ import (
// execute executes a shell command.
func exec(args ...string) error {
//nolint:gosec // G204: Subprocess launched with a potential tainted input or cmd arguments
cmd := osexec.Command(args[0], args[1:]...)
out, err := cmd.CombinedOutput()
switch err := err.(type) {
@@ -24,6 +24,7 @@ func exec(args ...string) error {
// execVerbose executes a shell command while displaying its output.
func execVerbose(args ...string) error {
//nolint:gosec // G204: Subprocess launched with a potential tainted input or cmd arguments
cmd := osexec.Command(args[0], args[1:]...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
+8 -7
View File
@@ -1,4 +1,3 @@
//nolint: gosec
package main
import (
@@ -7,7 +6,6 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
@@ -53,7 +51,8 @@ func Setup(testnet *e2e.Testnet) error {
if err != nil {
return err
}
err = ioutil.WriteFile(filepath.Join(testnet.Dir, "docker-compose.yml"), compose, 0644)
//nolint:gosec // G306: Expect WriteFile permissions to be 0600 or less
err = os.WriteFile(filepath.Join(testnet.Dir, "docker-compose.yml"), compose, 0o644)
if err != nil {
return err
}
@@ -76,7 +75,7 @@ func Setup(testnet *e2e.Testnet) error {
if node.Mode == e2e.ModeLight && strings.Contains(dir, "app") {
continue
}
err := os.MkdirAll(dir, 0755)
err := os.MkdirAll(dir, 0o755)
if err != nil {
return err
}
@@ -92,7 +91,8 @@ func Setup(testnet *e2e.Testnet) error {
if err != nil {
return err
}
err = ioutil.WriteFile(filepath.Join(nodeDir, "config", "app.toml"), appCfg, 0644)
//nolint:gosec // G306: Expect WriteFile permissions to be 0600 or less
err = os.WriteFile(filepath.Join(nodeDir, "config", "app.toml"), appCfg, 0o644)
if err != nil {
return err
}
@@ -401,11 +401,12 @@ func UpdateConfigStateSync(node *e2e.Node, height int64, hash []byte) error {
// FIXME Apparently there's no function to simply load a config file without
// involving the entire Viper apparatus, so we'll just resort to regexps.
bz, err := ioutil.ReadFile(cfgPath)
bz, err := os.ReadFile(cfgPath)
if err != nil {
return err
}
bz = regexp.MustCompile(`(?m)^trust_height =.*`).ReplaceAll(bz, []byte(fmt.Sprintf(`trust_height = %v`, height)))
bz = regexp.MustCompile(`(?m)^trust_hash =.*`).ReplaceAll(bz, []byte(fmt.Sprintf(`trust_hash = "%X"`, hash)))
return ioutil.WriteFile(cfgPath, bz, 0644)
//nolint:gosec // G306: Expect WriteFile permissions to be 0600 or less
return os.WriteFile(cfgPath, bz, 0o644)
}