Skip to content

Packages A and B both importing C use different C instances if you don't import C too. #22

Description

@tcard

Example: both net/http and github.com/gorilla/websocket use net/url, but if you try do to this:

_ = &websocket.Dialer{
    Proxy: http.ProxyFromEnvironment,
}

you get this:

cannot use http.ProxyFromEnvironment (value of type func(req *net/http.Request) (*net/url.URL \ ?error)) as func(req *net/http.Request) (*net/url.URL \ ?error) value in struct literal

because SGo believes that net/url.URL is a different type in both signatures.

If you import net/url as well, it does work. So doing import _ "net/url" is a workaround.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions