Skip to content

Commit

Permalink
Update args for gosec, with no args it runs the -h option (#47)
Browse files Browse the repository at this point in the history
* Update args for gosec, with no args it runs the -h option
  • Loading branch information
randeepdell authored Feb 3, 2022
1 parent 0b7ce03 commit 11c0953
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
uses: actions/checkout@v2
- name: Run Go Security
uses: securego/gosec@master
with:
# added additional exclude arguments after gosec v2.9.4 came out
args: -exclude=G304 ./...
malware_security_scan:
name: Malware Scanner
runs-on: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion core/semver/semver.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ func main() {
os.Exit(1)
}
w = fout
defer fout.Close()
defer func() {
if err := fout.Close(); err != nil {
fmt.Fprintf(os.Stderr, "error closing file: %s \n", err)
}
}()
}

gitdesc := chkErr(doExec("git", "describe", "--long", "--dirty"))
Expand Down
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ import (
)

func init() {
os.Setenv(constants.EnvGOCSIDebug, "true")
err := os.Setenv(constants.EnvGOCSIDebug, "true")
if err != nil {
fmt.Fprintf(os.Stderr, "unable to set %s to true \n", constants.EnvGOCSIDebug)
}
}

// main is ignored when this package is built as a go plug-in
Expand Down
6 changes: 5 additions & 1 deletion service/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,11 @@ func (s *service) ephemeralNodePublish(ctx context.Context, req *csi.NodePublish
}
log.Infof("Created file in target path %s", filePath+"/id")

defer f.Close()
defer func() {
if err := f.Close(); err != nil {
log.Errorf("Error closing file: %s \n", err)
}
}()
_, err2 := f.WriteString(createEphemeralVolResp.Volume.VolumeId)
if err2 != nil {
log.Error("Writing to id file in target path for ephemeral vol failed with error :" + err.Error())
Expand Down
9 changes: 7 additions & 2 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ func (s *service) getNewIsilonConfigs(ctx context.Context, configBytes []byte) (

var inputConfigs *IsilonClusters
var yamlErr error
var err error
inputConfigs, yamlErr = unmarshalYAMLContent(configBytes)
if yamlErr != nil {
log.Errorf("failed to parse isilon clusters' config details as yaml data, error: %v", yamlErr)
Expand All @@ -637,7 +638,8 @@ func (s *service) getNewIsilonConfigs(ctx context.Context, configBytes []byte) (
}

newIsiClusters := make(map[interface{}]interface{})
for i, config := range inputConfigs.IsilonClusters {
for i, clusterConfig := range inputConfigs.IsilonClusters {
config := clusterConfig
log.Debugf("parsing config details for cluster %v", config.ClusterName)
if config.ClusterName == "" {
return nil, defaultIsiClusterName, fmt.Errorf("invalid value for clusterName at index [%d]", i)
Expand Down Expand Up @@ -676,7 +678,10 @@ func (s *service) getNewIsilonConfigs(ctx context.Context, configBytes []byte) (

config.EndpointURL = fmt.Sprintf("https://%s:%s", config.Endpoint, config.EndpointPort)
clientCtx, _ := GetLogger(ctx)
config.isiSvc, _ = s.GetIsiService(clientCtx, &config, logLevel)
config.isiSvc, err = s.GetIsiService(clientCtx, &config, logLevel)
if err != nil {
log.Errorf("failed to get isi client, error: %v", err)
}

if config.IsDefault == nil {
defaultBoolValue := false
Expand Down

0 comments on commit 11c0953

Please sign in to comment.