Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit a767ca5

Browse files
committed
Make the code for matching templates more readable
1 parent 5ba8b59 commit a767ca5

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

internals/secrethub/migrate_config_templates.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,12 @@ func migrateTemplateTags(inFile io.Reader, outFile string, mapping referenceMapp
5555

5656
var hits, misses []string
5757
output := regexpSecretTemplateTags.ReplaceAllStringFunc(string(raw), func(templateTag string) string {
58-
path := regexpSecretTemplateTags.FindStringSubmatch(templateTag)
58+
path := regexpSecretTemplateTags.FindStringSubmatch(templateTag)[1]
5959

60-
if path == nil {
61-
misses = append(misses, templateTag)
62-
return ""
63-
}
64-
65-
opRef, ok := mapping[path[1]]
60+
opRef, ok := mapping[path]
6661
if !ok {
67-
misses = append(misses, path[1])
68-
return path[1]
62+
misses = append(misses, path)
63+
return path
6964
}
7065

7166
hits = append(hits, opRef)

0 commit comments

Comments
 (0)