-
Notifications
You must be signed in to change notification settings - Fork 609
Build Failing - Missing "context" package #116
Comments
Running |
Which version of Go are you using? |
We are using the golang-1.6 package in the Ubuntu 16.04 release:
|
We use a docker image built from this Dockerfile for Go development: https://github.com/hyperledger/sawtooth-core/blob/master/docker/sawtooth-dev-go |
That explains why this is happening. The context package was only added in Go 1.7. If at all possible, I think you should upgrade your image to use Go 1.9.1 (that's the latest release). This should be simple since the Go releases are backwards compatible since 1.0. If that's not possible then you can pin gomock to the latest version that worked for you. That would be 4887ba1. I don't think we should try to fix this in the gomock package. |
Despite what I said before, backwards compatibility was restored in #118 |
The compatibility issue was solved: golang/mock#116 (comment) Signed-off-by: Nick Drozd <drozd@bitwise.io>
The compatibility issue was solved: golang/mock#116 (comment) Signed-off-by: Nick Drozd <drozd@bitwise.io>
Fixes golang#116 # Problem If your mock an interface that matches the fmt.Stringer interface: ```go type Stringer interface { String() string } ``` Then your unit tests can deadlock if you provide that mock as an expected argument to a call that is not matched (i.e. fails the test). Because, when printing the error message for the call that was not matched, it calls `String()` on all arguments that support it, including the mock. But each call to a mock is protected with a mutex, and the previous call (that was not matched) has not yet exited. # Solution The solution has two parts 1. During mock code generation (an existing part of this library) add a unique method on mocks (ISGOMOCK) 1. During test execution, whenever we are stringifying something that might be a mock, check if it is a mock (ISGOMOCK) that implements the String() method. If it is, just use the type name as the string value, instead of calling String() (which would cause the deadlock).
After #111 was merged, I am now getting build failures in our CI process with the error:
cannot find package "context" in any of:
and then a list of directories in GOPATH.
The text was updated successfully, but these errors were encountered: