From 248373c5d80fe5b89240214a0e72016602a8fda2 Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Sun, 7 Nov 2021 16:26:09 +0000 Subject: [PATCH] avoid evaluating symlinks for now We use module paths in many different places and we this ensure we will compare the same paths consistently and avoid duplicate entries in memdb. --- internal/langserver/handlers/initialize.go | 2 +- internal/terraform/module/module_manager.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/langserver/handlers/initialize.go b/internal/langserver/handlers/initialize.go index a08166b60..b836675ee 100644 --- a/internal/langserver/handlers/initialize.go +++ b/internal/langserver/handlers/initialize.go @@ -266,7 +266,7 @@ func resolvePath(rootDir, rawPath string) (string, error) { } func cleanupPath(path string) (string, error) { - absPath, err := filepath.EvalSymlinks(path) + absPath, err := filepath.Abs(path) return toLowerVolumePath(absPath), err } diff --git a/internal/terraform/module/module_manager.go b/internal/terraform/module/module_manager.go index 9938bd8de..9c3c951f3 100644 --- a/internal/terraform/module/module_manager.go +++ b/internal/terraform/module/module_manager.go @@ -68,7 +68,9 @@ func (mm *moduleManager) AddModule(modPath string) (Module, error) { err := mm.moduleStore.Add(modPath) if err != nil { - return nil, err + if _, ok := err.(*state.AlreadyExistsError); !ok { + return nil, err + } } // TODO: Avoid returning new module, just the error from adding