From 1efa34ac0f0a2fc13e468590c51d2e3dad4d0de1 Mon Sep 17 00:00:00 2001 From: bit0rez Date: Wed, 28 Feb 2018 23:35:41 +1000 Subject: [PATCH] Fix dummy mistake. --- main.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/main.go b/main.go index a68ba0c..14bf6e0 100644 --- a/main.go +++ b/main.go @@ -11,11 +11,6 @@ const envDelimiter string = "=" const paramsListDelimiter string = "," const paramsListSuffix string = "LIST" -type envContainer struct { - Value string - List []string -} - func getArgs() (string, string, string) { inFileName := flag.String("i", "", "Input file name") outFileName := flag.String("o", "", "Output file name") @@ -40,10 +35,10 @@ func getArgs() (string, string, string) { return *inFileName, *outFileName, *prefix } -func getParams(prefix string, suffix string, delimiter string) map[string]envContainer { +func getParams(prefix string, suffix string, delimiter string) map[string]interface{} { prefixShift := len(prefix) + 1 suffixLen := len(suffix) - tplParams := make(map[string]envContainer) + tplParams := make(map[string]interface{}) for _, e := range os.Environ() { pair := strings.Split(e, envDelimiter) @@ -54,15 +49,15 @@ func getParams(prefix string, suffix string, delimiter string) map[string]envCon if strings.HasSuffix(pair[0], suffix) { suffixShift := len(pair[0]) - suffixLen - 1 paramName = pair[0][prefixShift:suffixShift] - paramValue = pair[1] trimmer := strings.Join([]string{delimiter, " "}, "") paramList = strings.Split(strings.Trim(pair[1], trimmer), delimiter) + tplParams[paramName] = paramList } else { paramName = pair[0][prefixShift:] paramValue = pair[1] - paramList = []string{pair[1]} + tplParams[paramName] = paramValue } - tplParams[paramName] = envContainer{paramValue, paramList} + } }