Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter list not matching. No matching Method found for EndPoint #9

Open
GoogleCodeExporter opened this issue Apr 20, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
package main

import (
  "fmt"
  "net/http"
  goRest "code.google.com/p/gorest"
  rethinkDb "github.com/christopherhesse/rethinkgo"
)

func main() {
  goRest.RegisterService(new(Console)) //Register our service
  http.Handle("/", goRest.Handle())
  fmt.Printf("Web Application Listening...\n")
  http.ListenAndServe(":3000", nil)
}

//Service Definition
type Console struct {
  goRest.RestService `root:"/" consumes:"application/json" produces: "application/json"`
  getReadings        goRest.EndPoint `method:"GET" path:"/readings/" output:"[]interface{}"`
}

func (serv Console) GetReadings()([]interface{}) {
  databaseName := "test"
  tableName := "readings"
  session, _ := rethinkDb.Connect("localhost:28015", databaseName)

  var response []interface{}
  _ = rethinkDb.Table(tableName).Run(session).All(&response)
  fmt.Printf("response:", response)

  return response
}

What is the expected output? What do you see instead?
I expect to have the application startup without issue...

Instead I get this error...

$ go run console.go

2013/04/22 22:38:29 All EndPoints for service [ Console ] , registered under 
root path:  /
2013/04/22 22:38:29 Parameter list not matching. No matching Method found for 
EndPoint:[getReadings],type:[GET] . Expecting: #func(serv Console) 
GetReadings()([]interface{})# with one([]interface{}) return parameter.
panic: Parameter list not matching. No matching Method found for 
EndPoint:[getReadings],type:[GET] . Expecting: #func(serv Console) 
GetReadings()([]interface{})# with one([]interface{}) return parameter.

goroutine 1 [running]:
log.Panic(0x2500bd8, 0x100000001)
  /usr/local/go/src/pkg/log/log.go:307 +0x9f
code.google.com/p/gorest.mapFieldsToMethods(0xf84008b000, 0x1f7f18, 0x2233cc, 
0x527465670000000b, 0x22426c, ...)
  /Users/nunya/.mygo/src/code.google.com/p/gorest/reflect.go:103 +0x684
code.google.com/p/gorest.registerService(0x217c1c, 0xf800000000, 0x1f1fa8, 
0xf84006bb00, 0x1f1fa8, ...)
  /Users/nunya/.mygo/src/code.google.com/p/gorest/reflect.go:66 +0x4ad
code.google.com/p/gorest.RegisterServiceOnPath(0x217c1c, 0x0, 0x1f1fa8, 
0xf84006bb00, 0x204d, ...)
  /Users/nunya/.mygo/src/code.google.com/p/gorest/gorest.go:182 +0x116
code.google.com/p/gorest.RegisterService(0x1f1fa8, 0xf84006bb00)
  /Users/nunya/.mygo/src/code.google.com/p/gorest/gorest.go:137 +0x42
main.main()
  /Users/nunya/Projects/golang/console/console.go:15 +0x4d

goroutine 2 [syscall]:
created by runtime.main
  /usr/local/go/src/pkg/runtime/proc.c:221
exit status 2
What version of the product are you using? On what operating system?


Please provide any additional information below.

I'm not sure what else to do.  The error message seems very helpful.  Tells me 
what function it's looking for.  However, that's exactly the function I have 
defined.

Original issue reported on code.google.com by [email protected] on 22 Apr 2013 at 10:41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant