Merge pull request #286 from parrobe/gosec

fix gosec failures
This commit is contained in:
Rob Parker
2019-03-08 13:36:54 +00:00
committed by GitHub
3 changed files with 6 additions and 1 deletions

View File

@@ -36,6 +36,7 @@ func processTemplateFile(templateFile, destFile string, data interface{}) error
_, err = os.Stat(dir) _, err = os.Stat(dir)
if err != nil { if err != nil {
if os.IsNotExist(err) { if os.IsNotExist(err) {
// #nosec G301
err = os.MkdirAll(dir, 0770) err = os.MkdirAll(dir, 0770)
if err != nil { if err != nil {
log.Error(err) log.Error(err)

View File

@@ -45,7 +45,10 @@ func doMain() error {
// Check whether they only want debug info // Check whether they only want debug info
if *infoFlag { if *infoFlag {
logVersionInfo() logVersionInfo()
logContainerDetails() err = logContainerDetails()
if err != nil {
log.Printf("Error displaying container details: %v", err)
}
return nil return nil
} }

View File

@@ -42,6 +42,7 @@ func verifySingleProcess() error {
// Verifies that there is only one instance running of the given program name. // Verifies that there is only one instance running of the given program name.
func verifyOnlyOne(programName string) (int, error) { func verifyOnlyOne(programName string) (int, error) {
// #nosec G104
out, _, _ := command.Run("ps", "-e", "--format", "cmd") out, _, _ := command.Run("ps", "-e", "--format", "cmd")
//if this goes wrong then assume we are the only one //if this goes wrong then assume we are the only one
numOfProg := strings.Count(out, programName) numOfProg := strings.Count(out, programName)