I want use a controller to implement a set with three functions:union, intersection and subtraction. I write a function to receive two string from POST:
func (c * SetController) Post(){
Slice1 := c.GetString("Slice1)
Slice2 := c.GetString("Slice2)
}
Then I write a union function to get the union set answer:
func (c *SetController) Union(Slice1 string, Slice2 string) {
var temp1 []string = strings.Split(Slice1, ",")
var temp2 []string = strings.Split(Slice2, ",")
myslice1 := make([]int, 0)
for x,_ := range temp1 {
myslice1 = append(myslice1, x)
}
myslice2 := make([]int, 0)
for x,_ := range temp2 {
myslice2 = append(myslice2, x)
}
UnionAnswer := union(myslice1, myslice2)
c.Data["UnionAnswer"] = UnionAnswer
c.TplName = "index.tpl"
}
But after I upload the data:
curl -X POST "http://localhost:8080/?Slice1=1,3,5,6&Slice2=2,4,5,6"
and get the union answer:
curl -X GET "http://localhost:8080/getUnion"
It return a error: Handler crashed with error reflect: Call with too few input arguments
I wonder why and how to debug.
Aucun commentaire:
Enregistrer un commentaire