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

Name Resolve Failing #516

Closed
zignig opened this issue Jan 8, 2015 · 2 comments
Closed

Name Resolve Failing #516

zignig opened this issue Jan 8, 2015 · 2 comments

Comments

@zignig
Copy link

zignig commented Jan 8, 2015

on 5853a25

ipfs name resolve

2015/01/08 10:39:38 http: panic serving 127.0.0.1:47416: Commands must return a pointer, io.Reader, or channel
goroutine 2511 [running]:
net/http.func·011()
/usr/local/go/src/pkg/net/http/server.go:1100 +0xb7
runtime.panic(0x906b20, 0xc208b07ba0)
/usr/local/go/src/pkg/runtime/panic.c:248 +0x18d
github.com/jbenet/go-ipfs/commands.checkType(0x906b20, 0xc208b07b90, 0x0, 0x0, 0x0, 0x0)
/usr/local/golang/src/github.com/jbenet/go-ipfs/commands/command.go:262 +0x13e
github.com/jbenet/go-ipfs/commands.(_Command).Call(0xef40a0, 0x2b5a7240a418, 0xc2083930e0, 0x0, 0x0)
/usr/local/golang/src/github.com/jbenet/go-ipfs/commands/command.go:117 +0x68e
github.com/jbenet/go-ipfs/commands/http.Handler.ServeHTTP(0x1, 0xc20800ef40, 0x15, 0xc2080403c0, 0xc6a1a0, 0xc208060240, 0xc20800efa0, 0xef40a0, 0xaeeef0, 0x0, ...)
/usr/local/golang/src/github.com/jbenet/go-ipfs/commands/http/handler.go:67 +0x377
github.com/jbenet/go-ipfs/commands/http.(_Handler).ServeHTTP(0xc208456910, 0x2aaaaac11ad0, 0xc2080630e0, 0xc20845c000)
:2 +0xb5
net/http.(_ServeMux).ServeHTTP(0xc208333800, 0x2aaaaac11ad0, 0xc2080630e0, 0xc20845c000)
/usr/local/go/src/pkg/net/http/server.go:1511 +0x1a3
net/http.serverHandler.ServeHTTP(0xc2080434f8, 0x2aaaaac11ad0, 0xc2080630e0, 0xc20845c000)
/usr/local/go/src/pkg/net/http/server.go:1673 +0x19f
net/http.(_conn).serve(0xc208d14b00)
/usr/local/go/src/pkg/net/http/server.go:1174 +0xa7e
created by net/http.(*Server).Serve
/usr/local/go/src/pkg/net/http/server.go:1721 +0x313

@jbenet
Copy link
Member

jbenet commented Jan 8, 2015

@mappum

It's definitely not go idiomatic, but it works. Yeah, it's solid and mergeable.

Famous last words. the compiler is there for a reason. This is reflect abuse, and is going to keep hurting. Let's do this instead:

type Result struct {
   Value interface{}
   Chan chan interface{}
   Reader io.Reader
}

And, if you can get rid of interface{} too, that'd be great. make a specific interface, like this:

type ReturnValue interface {
  WriteTo(w io.Writer)
}

Yeah. That actually obviates the need for the Result above-- can implement specific types for each of those.

Maybe commands can write to a response Writer directly. This makes sense, by the way, as all commands will have to be stream-friendly.

@jbenet
Copy link
Member

jbenet commented Jan 8, 2015

Sorry for breaking things @zignig, reverted back to 04b938b.

@mappum I restored the assert-types branch

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

No branches or pull requests

2 participants