Skip to content

Commit fe2237b

Browse files
committed
use empty string as undefined
1 parent 347b7ce commit fe2237b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

pkg/iac/scanners/terraform/parser/option.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func OptionWithLogger(log *log.Logger) Option {
3030

3131
func OptionWithWorkingDirectoryPath(cwd string) Option {
3232
return func(p *Parser) {
33-
p.cwd = &cwd
33+
p.cwd = cwd
3434
}
3535
}
3636

pkg/iac/scanners/terraform/parser/parser.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ type Parser struct {
5252
fsMap map[string]fs.FS
5353
configsFS fs.FS
5454
skipPaths []string
55-
// cwd is optional, if provided it will be used instead of 'os.Getwd'
56-
// for populating 'path.cwd' in terraform
57-
cwd *string
55+
// cwd is optional, if left to empty string, 'os.Getwd'
56+
// will be used for populating 'path.cwd' in terraform.
57+
cwd string
5858
}
5959

6060
// New creates a new Parser
@@ -297,8 +297,8 @@ func (p *Parser) Load(_ context.Context) (*evaluator, error) {
297297
}
298298

299299
var workingDir string
300-
if p.cwd != nil {
301-
workingDir = *p.cwd
300+
if p.cwd != "" {
301+
workingDir = p.cwd
302302
} else {
303303
workingDir, err = os.Getwd()
304304
if err != nil {

0 commit comments

Comments
 (0)