Skip to content

Commit 852f128

Browse files
authored
Merge pull request #76 from sudo-bmitch/pr-key-templates
Fix: Handle nested templates in key field
2 parents 7b80b34 + 893b3cb commit 852f128

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

internal/processor/processor.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,12 @@ func (p *processor) getVer(curVer string, matchArgs map[string]string) (string,
9090
if err != nil {
9191
return curVer, fmt.Errorf("failed to template args: processor=%v, %v", *p, err)
9292
}
93+
tdp.processor.Source = src
9394
key, err := template.String(p.Processor.Key, tdp)
9495
if err != nil {
9596
return curVer, fmt.Errorf("failed to template key: processor=%v, %v", *p, err)
9697
}
98+
tdp.Processor.Key = key
9799
// TODO: handle different options for source (read from current lock or real source)
98100
results, err := source.Get(src)
99101
if err != nil {

root.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ func (cli *cliOpts) runAction(cmd *cobra.Command, args []string) error {
182182
}
183183
// display changes
184184
for _, change := range changes {
185-
fmt.Printf("Version changed: filename=%s, scan=%s, source=%s, key=%s, old=%s, new=%s\n",
186-
change.Filename, change.Scan, change.Source, change.Key, change.Orig, change.New)
185+
fmt.Printf("Version changed: filename=%s, processor=%s, key=%s, old=%s, new=%s\n",
186+
change.Filename, change.Processor, change.Key, change.Orig, change.New)
187187
}
188188

189189
if origDir != "." {

0 commit comments

Comments
 (0)