diff --git a/pkg/jq/parser.go b/pkg/jq/parser.go index c4e28fd..73a5e1d 100644 --- a/pkg/jq/parser.go +++ b/pkg/jq/parser.go @@ -4,15 +4,20 @@ import ( "fmt" "github.com/itchyny/gojq" "strings" + "sync" ) +var mutex = &sync.Mutex{} + func runJQQuery(jqQuery string, obj interface{}) (interface{}, error) { query, err := gojq.Parse(jqQuery) if err != nil { return nil, err } + mutex.Lock() queryRes, ok := query.Run(obj).Next() + mutex.Unlock() if !ok { return nil, fmt.Errorf("query should return at least one value")