From 5f3a6807b619919a4b1e01872849b40e44986201 Mon Sep 17 00:00:00 2001 From: piwowarc Date: Thu, 5 Apr 2018 11:40:34 +0200 Subject: [PATCH 1/3] remove redundant functionality --- intrinsicsolver/fixFunctions.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/intrinsicsolver/fixFunctions.go b/intrinsicsolver/fixFunctions.go index 41f19dd..d250cae 100644 --- a/intrinsicsolver/fixFunctions.go +++ b/intrinsicsolver/fixFunctions.go @@ -15,14 +15,13 @@ var mapNature = functions[5:] /* FixFunctions : takes []byte file and firstly converts all single quotation marks to double ones (anything between single ones is treated as the rune in GoLang), -then deconstructs file into lines, checks for intrinsic functions. The FixFunctions has modes: `multiline`, `elongate`, `correctlong` and `temp`. +then deconstructs file into lines, checks for intrinsic functions. The FixFunctions has modes: `multiline`, `elongate`, `correctlong`. Mode `multiline` looks for functions of a map nature where the function name is located in one line and it's body (map elements) are located in the following lines (if this would be not fixed an error would be thrown: `json: unsupported type: map[interface {}]interface {}`). The function changes the notation by putting function name in the next line with proper indentation. Mode `elongate` exchanges the short function names into their proper, long equivalent. Mode `correctlong` prepares the file for conversion into JSON. If the file is a YAML with every line being solicitously indented, there is no problem and the `elongate` mode is all we need. But if there is any mixed notation (e.g. indented maps along with one-line maps, functions in one line with the key), parsing must be preceded with some additional operations. -Mode `temp` allows the user to save the result to a temporary file `.preprocessed.yml`. The result is returned as a []byte array. */ func FixFunctions(template []byte, logger *logger.Logger, mode ...string) ([]byte, error) { @@ -73,16 +72,6 @@ func FixFunctions(template []byte, logger *logger.Logger, mode ...string) ([]byt stringStream := strings.Join(temporaryResult, "\n") output := []byte(stringStream) - for _, m := range mode { - if m == "temp" { - if err := writeLines(temporaryResult, ".preprocessed.yml"); err != nil { - logger.Error(err.Error()) - return nil, err - } - logger.Info("Created temporary file of a preprocessed template `.preprocessed.yml`") - } - } - return output, nil } From ff67b9bdd5692043f330d0e7bb7507a9bebb2582 Mon Sep 17 00:00:00 2001 From: piwowarc Date: Thu, 5 Apr 2018 11:50:46 +0200 Subject: [PATCH 2/3] typo --- intrinsicsolver/fixFunctions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intrinsicsolver/fixFunctions.go b/intrinsicsolver/fixFunctions.go index d250cae..a8dabf2 100644 --- a/intrinsicsolver/fixFunctions.go +++ b/intrinsicsolver/fixFunctions.go @@ -15,7 +15,7 @@ var mapNature = functions[5:] /* FixFunctions : takes []byte file and firstly converts all single quotation marks to double ones (anything between single ones is treated as the rune in GoLang), -then deconstructs file into lines, checks for intrinsic functions. The FixFunctions has modes: `multiline`, `elongate`, `correctlong`. +then deconstructs file into lines, checks for intrinsic functions. The FixFunctions has modes: `multiline`, `elongate` and `correctlong`. Mode `multiline` looks for functions of a map nature where the function name is located in one line and it's body (map elements) are located in the following lines (if this would be not fixed an error would be thrown: `json: unsupported type: map[interface {}]interface {}`). The function changes the notation by putting function name in the next line with proper indentation. From 29ec3deb2d33236c4eb290fd2024f30a7444a2c2 Mon Sep 17 00:00:00 2001 From: piwowarc Date: Thu, 5 Apr 2018 12:12:18 +0200 Subject: [PATCH 3/3] update .gitignore --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index f2ba980..f13c795 100644 --- a/.gitignore +++ b/.gitignore @@ -21,8 +21,5 @@ perun # Local perun configuration: .perun -# This is a temporary file which is being created when FixFunctions is called from intrinsicsolver package. -.preprocessed.yml - # Internal Visual Studio Code config .vscode