mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-08 22:23:11 +00:00
* 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>
52 lines
1.4 KiB
Go
52 lines
1.4 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
osexec "os/exec"
|
|
"path/filepath"
|
|
)
|
|
|
|
// 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) {
|
|
case nil:
|
|
return nil
|
|
case *osexec.ExitError:
|
|
return fmt.Errorf("failed to run %q:\n%v", args, string(out))
|
|
default:
|
|
return err
|
|
}
|
|
}
|
|
|
|
// 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
|
|
return cmd.Run()
|
|
}
|
|
|
|
// execCompose runs a Docker Compose command for a testnet.
|
|
func execCompose(dir string, args ...string) error {
|
|
return exec(append(
|
|
[]string{"docker-compose", "-f", filepath.Join(dir, "docker-compose.yml")},
|
|
args...)...)
|
|
}
|
|
|
|
// execComposeVerbose runs a Docker Compose command for a testnet and displays its output.
|
|
func execComposeVerbose(dir string, args ...string) error {
|
|
return execVerbose(append(
|
|
[]string{"docker-compose", "-f", filepath.Join(dir, "docker-compose.yml")},
|
|
args...)...)
|
|
}
|
|
|
|
// execDocker runs a Docker command.
|
|
func execDocker(args ...string) error {
|
|
return exec(append([]string{"docker"}, args...)...)
|
|
}
|