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

cannot use func literal (type func("golang.org/x/net/context".Context, interface {}) for go-kit example #28

Closed
TsuyoshiUshio opened this issue May 9, 2017 · 2 comments

Comments

@TsuyoshiUshio
Copy link

I tried this example. However, I've got an error when I try go test -v .

https://github.com/pact-foundation/pact-go/tree/master/examples/go-kit

At first, I've got this error. (before this, I go get for go-kit)

$ go test -v .
endpoints.go:8:2: cannot find package "golang.org/x/net/context" in any of:
	/usr/local/Cellar/go/1.8/libexec/src/golang.org/x/net/context (from $GOROOT)
	/Users/ushio/go/src/golang.org/x/net/context (from $GOPATH)
/Users/ushio/go/src/github.com/go-kit/kit/transport/http/client.go:12:2: cannot find package "golang.org/x/net/context/ctxhttp" in any of:
	/usr/local/Cellar/go/1.8/libexec/src/golang.org/x/net/context/ctxhttp (from $GOROOT)
	/Users/ushio/go/src/golang.org/x/net/context/ctxhttp (from $GOPATH)

Then I try go get -u golang.org/x/net/context then I've got this.
How can I solve this problem?

# _/Users/ushio/Codes/pact/pact-go/examples/go-kit/provider
./endpoints.go:25: cannot use func literal (type func("golang.org/x/net/context".Context, interface {}) (interface {}, error)) as type endpoint.Endpoint in return argument
./transport.go:29: cannot use encodeError (type func("golang.org/x/net/context".Context, error, "net/http".ResponseWriter)) as type "github.com/go-kit/kit/transport/http".ErrorEncoder in argument to "github.com/go-kit/kit/transport/http".ServerErrorEncoder
./transport.go:39: too many arguments in call to "github.com/go-kit/kit/transport/http".NewServer
	have ("golang.org/x/net/context".Context, endpoint.Endpoint, func("golang.org/x/net/context".Context, *"net/http".Request) (interface {}, error), func("golang.org/x/net/context".Context, "net/http".ResponseWriter, interface {}) error, []"github.com/go-kit/kit/transport/http".ServerOption...)
	want (endpoint.Endpoint, "github.com/go-kit/kit/transport/http".DecodeRequestFunc, "github.com/go-kit/kit/transport/http".EncodeResponseFunc, ..."github.com/go-kit/kit/transport/http".ServerOption)
./transport.go:66: undefined: "github.com/go-kit/kit/transport/http".Error
./transport.go:74: undefined: "github.com/go-kit/kit/transport/http".DomainDecode
./transport.go:76: undefined: "github.com/go-kit/kit/transport/http".DomainDo
./user_service_test.go:90: undefined: "github.com/go-kit/kit/log".NewContext
./user_service_test.go:91: undefined: "github.com/go-kit/kit/log".NewContext
@mefellows
Copy link
Member

Hi @TsuyoshiUshio, were you able to successfully run the consumer test first (this is a prerequisite)?

Also, from your second stack trace it appears you are not running it within a standard go environment (e.g. the pact project you've cloned is not within a path such as <path/to>/src/github.com/pact-foundation/pact-go) - could this be the cause of your issues?

@mefellows
Copy link
Member

Closing due to inactivity.

mefellows added a commit that referenced this issue Aug 14, 2017
- Runs examples as integration tests
- Closes #28
- Closes #42
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