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

Context is importing interface as an anonymous field #185

Open
ThePiachu opened this issue Nov 24, 2015 · 0 comments
Open

Context is importing interface as an anonymous field #185

ThePiachu opened this issue Nov 24, 2015 · 0 comments

Comments

@ThePiachu
Copy link

It looks like Context is importing the http.ResponseWriter interface as an anonymous field (https://github.com/hoisie/web/blob/master/web.go#L33), which is an error in Go - this inserts dummy functions into the structure that if called can cause an error. A more proper way to indicate that Context conforms to the interface would be:

type Context struct {
Request *http.Request
Params map[string]string
Server *Server
}

var _ http.ResponseWriter = (*Context)(nil)

However, there are some functions missing from Context that will cause some more errors:

\hoisie\web\web.go:35: cannot use (*Context)(nil) (type *Context) as type http.ResponseWriter in assignment:
*Context does not implement http.ResponseWriter (missing Header method)

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

1 participant