From 1fe314b70b1101fff95114a944545dce9d4f8692 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Tue, 20 Oct 2020 16:49:38 -0700 Subject: [PATCH] getproviders: Don't log if EvalSymlinks changes nothing Previously this codepath was generating a confusing message in the absense of any symlinks, because filepath.EvalSymlinks returns a successful result if the target isn't a symlink. Now we'll emit the log line only if filepath.EvalSymlinks returns a result that's different in a way that isn't purely syntactic (which filepath.Clean would "fix"). The new message is a little more generic because technically we've not actually ensured that a difference here was caused by a symlink and so we shouldn't over-promise and generate something potentially misleading. --- internal/getproviders/filesystem_search.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/getproviders/filesystem_search.go b/internal/getproviders/filesystem_search.go index 15cc4662e..9c0e7e8f1 100644 --- a/internal/getproviders/filesystem_search.go +++ b/internal/getproviders/filesystem_search.go @@ -30,7 +30,9 @@ func SearchLocalDirectory(baseDir string) (map[addrs.Provider]PackageMetaList, e // symlink to help Terraform find them anyway. originalBaseDir := baseDir if finalDir, err := filepath.EvalSymlinks(baseDir); err == nil { - log.Printf("[TRACE] getproviders.SearchLocalDirectory: %s is a symlink to %s", baseDir, finalDir) + if finalDir != filepath.Clean(baseDir) { + log.Printf("[TRACE] getproviders.SearchLocalDirectory: using %s instead of %s", finalDir, baseDir) + } baseDir = finalDir } else { // We'll eat this particular error because if we're somehow able to