Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Apr 6, 2023
1 parent 6fc6aac commit 4825e25
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions provider/go.go
Expand Up @@ -75,7 +75,7 @@ func (p *Go) IntGetter() func() (int64, error) {
}
}

// StringGetter sends string request
// StringGetter parses string from request
func (p *Go) StringGetter() func() (string, error) {
return func() (res string, err error) {
v, err := p.vm.Eval(p.script)
Expand Down Expand Up @@ -107,14 +107,8 @@ func (p *Go) BoolGetter() func() (bool, error) {
}
}

func (p *Go) setParam(param string, val interface{}) error {
log.DEBUG.Printf("Setting param %s := %v;", param, val)
_, err := p.vm.Eval(fmt.Sprintf("%s := %v;", param, val))
return err
}

func (p *Go) paramAndEval(param string, val any) error {
err := p.setParam(param, val)
_, err := p.vm.Eval(fmt.Sprintf("%s := %v;", param, val))
if err == nil {
_, err = p.vm.Eval(p.script)
}
Expand Down

0 comments on commit 4825e25

Please sign in to comment.