Dep init fails in my test package due to gruntwork-io/terratest constraints


I filed an issue in github, mods please delete this…

I am new to both Go and terratest and I got the beginnings of a helm test off the ground in an existing project with no other Go code. If I follow the directions here: and run dep ensure -add I get “could not find project Gopkg.toml, use dep init to initiate a manifest”.

Then when I try to run dep init from my tests package directory, I get another error:

init failed: unable to solve the dependency graph: Solving failure: No versions of met constraints:
master: unable to update checked out version: fatal: reference is not a tree: 8e1b8d32e692162a446e97250c5d34f5a52efed6
: command failed: [git checkout 8e1b8d32e692162a446e97250c5d34f5a52efed6]: exit status 128
release-branch.go1.11: Could not introduce, as it is not allowed by constraint master from project
release-branch.go1.12: Could not introduce, as it is not allowed by constraint master from project

What am I missing?


Hi GwhorleyGH,

Here’s a simple example of getting this working…

$ mkdir myproj
$ cd my proj && mkdir test
$ cd test
$ vim example_test.go
    package test

    import (

    func TestExample(t *testing.T) {
      assert.Equal(t, "1", "1")

$ dep init
$ dep ensure -add

"" is not imported by your project, and has been 
temporarily added to Gopkg.lock and vendor/. If you run "dep ensure" again before actually importing it, it will disappear from Gopkg.lock and vendor/. 

You should now be able to go into example_test.go and add terratest to the import. Also, make sure you actually use the import in your code or the next time you run dep ensure it will remove it from your Gopkg.toml and Gopkg.lock files.