From 5e87c54e649ce9dfca3df3e87f1d3d212d7ecb29 Mon Sep 17 00:00:00 2001 From: Jordan Singer Date: Wed, 21 Dec 2022 16:12:28 -0600 Subject: [PATCH 1/2] return nil instead of empty map --- pkg/annotation/directive.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/annotation/directive.go b/pkg/annotation/directive.go index a77ac83a0..d3cb794d0 100644 --- a/pkg/annotation/directive.go +++ b/pkg/annotation/directive.go @@ -87,7 +87,7 @@ func (d Directives) Int(key string) (int, bool) { func (d Directives) Object(key string) Directives { v, ok := d[key] if !ok { - return make(Directives) + return nil } m, ok := v.(map[string]interface{}) if !ok { From b5f5c216cc757da56bfef08a7a4f0c388d75ead7 Mon Sep 17 00:00:00 2001 From: Jordan Singer Date: Wed, 21 Dec 2022 16:16:01 -0600 Subject: [PATCH 2/2] let persist plugin run even if env var, but dont log if no type and env var --- pkg/lang/javascript/plugin_persist.go | 7 +++---- pkg/lang/python/plugin_persist.go | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/pkg/lang/javascript/plugin_persist.go b/pkg/lang/javascript/plugin_persist.go index d9b014416..2d6cfc3a7 100644 --- a/pkg/lang/javascript/plugin_persist.go +++ b/pkg/lang/javascript/plugin_persist.go @@ -168,12 +168,11 @@ func (p *persister) handleFile(f *core.SourceFile, unit *core.ExecutionUnit) ([] continue } - if annot.Capability.Directives.Object(core.EnvironmentVariableDirective) != nil { - continue - } - keyType, pResult := p.determinePersistType(f, annot) if pResult == nil { + if annot.Capability.Directives.Object(core.EnvironmentVariableDirective) != nil { + continue + } log.Warn("Could not determine persist type") continue } diff --git a/pkg/lang/python/plugin_persist.go b/pkg/lang/python/plugin_persist.go index 0df20fee5..3a712915d 100644 --- a/pkg/lang/python/plugin_persist.go +++ b/pkg/lang/python/plugin_persist.go @@ -101,12 +101,11 @@ func (p *persister) handleFile(f *core.SourceFile, unit *core.ExecutionUnit) ([] continue } - if annot.Capability.Directives.Object(core.EnvironmentVariableDirective) != nil { - continue - } - keyType, pResult := p.determinePersistType(f, annot) if pResult == nil { + if annot.Capability.Directives.Object(core.EnvironmentVariableDirective) != nil { + continue + } log.Warn("Could not determine persist type") continue }