Skip to content
This repository has been archived by the owner on Jan 15, 2023. It is now read-only.

Commit

Permalink
Problem: make check shows errors
Browse files Browse the repository at this point in the history
Solution: tweak linters configurations and
fix code

Fixes #13.
  • Loading branch information
AlekSi committed Sep 29, 2018
1 parent 1e3444d commit e4188c7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@ linters:
issues:
exclude-use-default: false
exclude:
# gas: Duplicates errcheck, but with more false positives like strings.Builder.WriteString
# gosec: Duplicates errcheck, but with more false positives like strings.Builder.WriteString
- "G104: Errors unhandled"

# gosec: False positive triggered by `source, err := ioutil.ReadFile(f)`
- "G304: Potential file inclusion via variable"
5 changes: 3 additions & 2 deletions internal/gofuzz/corpus.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
package gofuzz

import (
"crypto/sha1"
"crypto/sha1" //nolint:gosec // go-fuzz uses SHA1 for non-cryptographic hashing
"fmt"
"io/ioutil"
"os"
Expand Down Expand Up @@ -39,6 +39,7 @@ func AddFileToCorpus(name string, data []byte) {

// AddDataToCorpus adds unnamed Gosh source code fragment to the go-fuzz corpus.
func AddDataToCorpus(prefix string, data []byte) {
name := fmt.Sprintf("%s-%040x.gosh", prefix, sha1.Sum(data))
// go-fuzz uses SHA1 for non-cryptographic hashing
name := fmt.Sprintf("%s-%040x.gosh", prefix, sha1.Sum(data)) //nolint:gosec
AddFileToCorpus(name, data)
}
2 changes: 1 addition & 1 deletion internal/golden/golden.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func init() {
panic(err)
}
for _, f := range files {
source, err := ioutil.ReadFile(f) //nolint:gas
source, err := ioutil.ReadFile(f)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func extractGoVersion(s string) string {
}

func goVersion() string {
cmd := exec.Command("go", "version") //nolint:gas
cmd := exec.Command("go", "version") //nolint:gosec
b, err := cmd.CombinedOutput()
if err != nil {
return ""
Expand Down

0 comments on commit e4188c7

Please sign in to comment.