Skip to content

Commit

Permalink
Hide dependencies in tools.go from importers
Browse files Browse the repository at this point in the history
Projects that use `go mod vendor` will vendor `github.com/matryer/moq`
despite it not being required at runtime.

Moving `tools.go` to `internal` hides this import from downstream
users and avoids `github.com/matryer/moq` being vendored.

`go generate` of the mocks still works as expected.

The assumption behind the import test broke, so I've pointed it at a
different path that has no Go code. This seems to match the intent
behind the original test for the `internal/code/..` path.
  • Loading branch information
danielwhite committed Jul 12, 2022
1 parent fb13091 commit a4defc3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/code/imports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ func TestNameForDir(t *testing.T) {

assert.Equal(t, "tmp", NameForDir("/tmp"))
assert.Equal(t, "code", NameForDir(wd))
assert.Equal(t, "internal", NameForDir(wd+"/.."))
assert.Equal(t, "docs", NameForDir(wd+"/../../docs"))
assert.Equal(t, "main", NameForDir(wd+"/../.."))
}
File renamed without changes.

0 comments on commit a4defc3

Please sign in to comment.