From a4defc334c41e8897b9961b3c2a9d9779e4d8283 Mon Sep 17 00:00:00 2001 From: Daniel White Date: Tue, 12 Jul 2022 12:17:07 +1000 Subject: [PATCH] Hide dependencies in `tools.go` from importers 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. --- internal/code/imports_test.go | 2 +- tools.go => internal/tools.go | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tools.go => internal/tools.go (100%) diff --git a/internal/code/imports_test.go b/internal/code/imports_test.go index fc8ed81a131..3cefb0f0b73 100644 --- a/internal/code/imports_test.go +++ b/internal/code/imports_test.go @@ -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+"/../..")) } diff --git a/tools.go b/internal/tools.go similarity index 100% rename from tools.go rename to internal/tools.go