Add gosec-check

This commit is contained in:
kolaente 2020-09-01 22:08:51 +02:00
parent 0e934f2635
commit 1596a4266a
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 8 additions and 1 deletions

View File

@ -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() {