PaesslerAG/gval

Without space after && leading error

Ovi3 opened this issue · 4 comments

Ovi3 commented
package main

import (
	"fmt"
	"github.com/PaesslerAG/gval"
)

func main() {
	vars := map[string]interface{}{"name": true}

	value, err := gval.Evaluate("true&&name", vars)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(value)

	value, err = gval.Evaluate("true&& name", vars)
	if err != nil {
		fmt.Println(err)
	}

	fmt.Println(value)
}

runing result:

parsing error: true&&name	 - 1:8 unknown operator &&n
<nil>
true

My expected result is the first expression also working fine.

yes this is because of the operator in
this operator should probably be a function in v2

Ovi3 commented

My current workaround is replacing "&&" to " && ".

By the way, any plan with v2 ?

Probably a version with generic in and output types next year. Depends on wether it works the way I envision it.

Ovi3 commented

Cool. Thanks for your reply.