From 312d5bda9a5fa225936c9ab14f6bce726ef5c731 Mon Sep 17 00:00:00 2001 From: lovestaco Date: Thu, 20 Jul 2023 21:16:10 +0530 Subject: [PATCH] Fixing all errors, linting --- parser/jsonparser.go | 3 ++- preprocess/expandvar.go | 1 + preprocess/preprocess.go | 2 +- tests/lama2_test.go | 3 --- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/parser/jsonparser.go b/parser/jsonparser.go index 62112b0a..d4edf9e8 100644 --- a/parser/jsonparser.go +++ b/parser/jsonparser.go @@ -25,7 +25,8 @@ func (p *Lama2Parser) PrimitiveType() (*gabs.Container, error) { // CustomPairMerge uses a gabs feature to deal with merge conflicts. // More here: https://github.com/HexmosTech/gabs/blob/master/gabs.go#L511 -func CustomPairMerge(_, source interface{}) interface{} { +//nolint:all +func CustomPairMerge(destination, source interface{}) interface{} { return source } diff --git a/preprocess/expandvar.go b/preprocess/expandvar.go index 70a638e7..9c723655 100644 --- a/preprocess/expandvar.go +++ b/preprocess/expandvar.go @@ -27,6 +27,7 @@ func Expand(s string, vm *goja.Runtime, mapping map[string]string) string { } buf = append(buf, s[i:j]...) name, w := getShellName(s[j+1:]) + //nolint:all if name == "" && w > 0 { // Encountered invalid syntax; eat the // characters. diff --git a/preprocess/preprocess.go b/preprocess/preprocess.go index 4f3b0d4c..96486ea0 100644 --- a/preprocess/preprocess.go +++ b/preprocess/preprocess.go @@ -73,7 +73,7 @@ func debugOp(str string) { func escapeString(input string) string { output, err := json.Marshal(input) if err != nil { - // handle error + log.Error().Str("Error marshaling JSON:","escapeString()") } return string(output) } diff --git a/tests/lama2_test.go b/tests/lama2_test.go index 9da7b359..e73f361d 100644 --- a/tests/lama2_test.go +++ b/tests/lama2_test.go @@ -63,9 +63,6 @@ func PerformParserMatch(text string) (*gabs.Container, error) { got, e := p.Parse(text) if e == nil { log.Debug().Str("Got", got.String()).Msg("") - } else { - // t.Errorf("Error not expected") - // fmt.Println(e) } return got, e }