Skip to content

Context is importing interface as an anonymous field #185

@ThePiachu

Description

@ThePiachu

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions