Browse Source

fix linters & switch to official linter (#4808)

pull/4816/head
Marko 5 years ago
committed by GitHub
parent
commit
678010c45e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 14 additions and 13 deletions
  1. +8
    -7
      .github/workflows/lint.yaml
  2. +1
    -1
      .golangci.yml
  3. +1
    -1
      cmd/tendermint/commands/root_test.go
  4. +1
    -1
      libs/cli/helper.go
  5. +1
    -1
      libs/tempfile/tempfile_test.go
  6. +1
    -1
      statesync/chunks.go
  7. +1
    -1
      tools/tm-signer-harness/main.go

+ 8
- 7
.github/workflows/lint.yaml View File

@ -1,13 +1,14 @@
name: Lint
on: [pull_request]
jobs:
golangci-lint:
golangci:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: golangci-lint
uses: reviewdog/action-golangci-lint@master
- uses: actions/checkout@v2
- uses: golangci/golangci-lint-action@master
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
golangci_lint_flags: "--timeout 30m"
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.26
args: --timeout 10m
github-token: ${{ secrets.github_token }}

+ 1
- 1
.golangci.yml View File

@ -38,7 +38,7 @@ linters:
# - whitespace
# - wsl
# - gocognit
# - nolintlint
- nolintlint
disable:
- errcheck


+ 1
- 1
cmd/tendermint/commands/root_test.go View File

@ -168,5 +168,5 @@ func WriteConfigVals(dir string, vals map[string]string) error {
data += fmt.Sprintf("%s = \"%s\"\n", k, v)
}
cfile := filepath.Join(dir, "config.toml")
return ioutil.WriteFile(cfile, []byte(data), 0666)
return ioutil.WriteFile(cfile, []byte(data), 0600)
}

+ 1
- 1
libs/cli/helper.go View File

@ -19,7 +19,7 @@ func WriteConfigVals(dir string, vals map[string]string) error {
data += fmt.Sprintf("%s = \"%s\"\n", k, v)
}
cfile := filepath.Join(dir, "config.toml")
return ioutil.WriteFile(cfile, []byte(data), 0666)
return ioutil.WriteFile(cfile, []byte(data), 0600)
}
// RunWithArgs executes the given command with the specified command line args


+ 1
- 1
libs/tempfile/tempfile_test.go View File

@ -27,7 +27,7 @@ func TestWriteFileAtomic(t *testing.T) {
}
defer os.Remove(f.Name())
if err = ioutil.WriteFile(f.Name(), old, 0664); err != nil {
if err = ioutil.WriteFile(f.Name(), old, 0600); err != nil {
t.Fatal(err)
}


+ 1
- 1
statesync/chunks.go View File

@ -84,7 +84,7 @@ func (q *chunkQueue) Add(chunk *chunk) (bool, error) {
}
path := filepath.Join(q.dir, strconv.FormatUint(uint64(chunk.Index), 10))
err := ioutil.WriteFile(path, chunk.Chunk, 0644)
err := ioutil.WriteFile(path, chunk.Chunk, 0600)
if err != nil {
return false, fmt.Errorf("failed to save chunk %v to file %v: %w", chunk.Index, path, err)
}


+ 1
- 1
tools/tm-signer-harness/main.go View File

@ -136,7 +136,7 @@ func extractKey(tmhome, outputPath string) {
stateFile := filepath.Join(internal.ExpandPath(tmhome), "data", "priv_validator_state.json")
fpv := privval.LoadFilePV(keyFile, stateFile)
pkb := [64]byte(fpv.Key.PrivKey.(ed25519.PrivKeyEd25519))
if err := ioutil.WriteFile(internal.ExpandPath(outputPath), pkb[:32], 0644); err != nil {
if err := ioutil.WriteFile(internal.ExpandPath(outputPath), pkb[:32], 0600); err != nil {
logger.Info("Failed to write private key", "output", outputPath, "err", err)
os.Exit(1)
}


Loading…
Cancel
Save