My project, using Go 1.8, has a dependency on github.com/stretchr/testify
. I retrieved the latest using go get -u github.com/stretchr/testify
and the version in $GOPATH/src
appears to be correct.
I added the latest version number as a contraint in Gopkg.toml
:
[[constraint]]
name = "github.com/stretchr/testify"
version = "1.1.4"
I then ran dep ensure -update
and then dep status
to update the vendor
directory (output of dep status
):
github.com/stretchr/testify ^1.1.4 v1.1.4 69483b4 69483b4 1
The version in $GOPATH/src
contains, in the file github.com/stretchr/testify/assert/assertions.go
, the function PanicsWithValue
:
func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
// ...
}
func PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool {
// ...
}
func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
// ...
}
but in the version in vendor
, that function is missing:
func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
// ...
}
func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
// ...
}
What am I doing wrong? I would like to use the function PanicsWithValue
in my testing. I even tried deleting the entire vendor
directory and rebuilding it.
By pinning the version to v1.1.4, you're specifically telling dep
to use a version that does not include the feature you want (check the history of the testify package on GitHub - v1.1.4 is from last September, PanicsWithValue
was added this past June). If you unpin the version (version = "*"
) it should use master@HEAD which includes PanicsWithValue
.