Add gosec-check
This commit is contained in:
parent
0e934f2635
commit
1596a4266a
|
@ -61,6 +61,7 @@ var (
|
|||
"ineffassign-check": IneffassignCheck,
|
||||
"gocyclo-check": GocycloCheck,
|
||||
"static-check": StaticCheck,
|
||||
"gosec-check": GoSecCheck,
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -339,8 +340,14 @@ func StaticCheck() {
|
|||
runAndStreamOutput("staticcheck", ApiPackages...)
|
||||
}
|
||||
|
||||
// Checks the source code for potential security issues
|
||||
func GoSecCheck() {
|
||||
|
||||
if err := exec.Command("gosec").Run(); err != nil && strings.Contains(err.Error(), "executable file not found") {
|
||||
fmt.Println("Please manually install gosec by running")
|
||||
fmt.Println("curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | bash -s -- -b $GOPATH/bin v2.2.0")
|
||||
os.Exit(1)
|
||||
}
|
||||
runAndStreamOutput("gosec", "./...")
|
||||
}
|
||||
|
||||
func GoconstCheck() {
|
||||
|
|
Loading…
Reference in New Issue