Fix gometalinter issues

Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
This commit is contained in:
Madhu Rajanna
2019-01-29 01:25:10 +05:30
parent 7a0c233c27
commit ca2e475296
9 changed files with 214 additions and 136 deletions

View File

@ -39,15 +39,13 @@ const cephKeyring = `[client.{{.UserID}}]
key = {{.Key}}
`
// gosec
const cephSecret = `{{.Key}}`
const cephSecret = `{{.Key}}` // #nosec
// gosec
const (
cephConfigRoot = "/etc/ceph"
cephConfigFileNameFmt = "ceph.share.%s.conf"
cephKeyringFileNameFmt = "ceph.share.%s.client.%s.keyring"
cephSecretFileNameFmt = "ceph.share.%s.client.%s.secret"
cephSecretFileNameFmt = "ceph.share.%s.client.%s.secret" // #nosec
)
var (
@ -78,7 +76,7 @@ type cephConfigData struct {
}
func writeCephTemplate(fileName string, m os.FileMode, t *template.Template, data interface{}) error {
// gosec
// #nosec
if err := os.MkdirAll(cephConfigRoot, 0755); err != nil {
return err
}

View File

@ -40,7 +40,7 @@ func makeVolumeID(volName string) volumeID {
func execCommand(command string, args ...string) ([]byte, error) {
glog.V(4).Infof("cephfs: EXEC %s %s", command, args)
cmd := exec.Command(command, args...)
cmd := exec.Command(command, args...) // #nosec
return cmd.CombinedOutput()
}

View File

@ -36,7 +36,9 @@ var (
// Load available ceph mounters installed on system into availableMounters
// Called from driver.go's Run()
func loadAvailableMounters() error {
// #nosec
fuseMounterProbe := exec.Command("ceph-fuse", "--version")
// #nosec
kernelMounterProbe := exec.Command("mount.ceph")
if fuseMounterProbe.Run() == nil {

View File

@ -132,8 +132,8 @@ func newVolumeOptions(volOptions, secret map[string]string) (*volumeOptions, err
}
// This field is optional, don't check for its presence
// nolint: errcheck
// (skip errcheck as this is optional)
// nolint
// (skip errcheck and gosec as this is optional)
extractOption(&opts.Mounter, "mounter", volOptions)
if err = opts.validate(); err != nil {