While learning go I came to following error:
prog.go:18: not enough arguments in call to method expression JSONParser.Parse
in my test progra
Your error unfortunately is somewhat misleading. The issue is that it is an instance method and you're calling it as if it's a method at the packages scope.
You need something like this;
func main() {
var in []byte
jp := JSONParser{}
actual, err2 := jp.Parse(in)
}
I'm guessing the error is worded like that because a receiver (thing in parens on the left hand site of function name) is handled like any other argument being passed to a function in the background.
If you wanted to call your method like that the definition would just be func Parse(toParse []byte) ([]Schema, int)
and if it were in a package called JSONParser
then that would be the correct syntax. If it were defined in the same package as in your example you would just call it like Parse(in)