From a01932d6a77a750ffae8df71982b155a9cfda53c Mon Sep 17 00:00:00 2001 From: "Giau. Tran Minh" Date: Wed, 15 May 2024 20:08:19 +0700 Subject: [PATCH] module: remove deadcode for parsing error --- internal/state/module.go | 6 +----- internal/state/module_test.go | 2 +- internal/terraform/module/module_ops.go | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/internal/state/module.go b/internal/state/module.go index 10838bc0..7f8c318a 100644 --- a/internal/state/module.go +++ b/internal/state/module.go @@ -125,7 +125,6 @@ type Module struct { ParsedModuleFiles ast.ModFiles ParsedVarsFiles ast.VarsFiles ModuleParsingErr error - VarsParsingErr error Meta ModuleMetadata MetaErr error @@ -174,7 +173,6 @@ func (m *Module) Copy() *Module { VarsRefOriginsState: m.VarsRefOriginsState, ModuleParsingErr: m.ModuleParsingErr, - VarsParsingErr: m.VarsParsingErr, Meta: m.Meta.Copy(), MetaErr: m.MetaErr, @@ -853,7 +851,7 @@ func (s *ModuleStore) UpdateParsedModuleFiles(path string, pFiles ast.ModFiles, return nil } -func (s *ModuleStore) UpdateParsedVarsFiles(path string, vFiles ast.VarsFiles, vErr error) error { +func (s *ModuleStore) UpdateParsedVarsFiles(path string, vFiles ast.VarsFiles) error { txn := s.db.Txn(true) defer txn.Abort() @@ -864,8 +862,6 @@ func (s *ModuleStore) UpdateParsedVarsFiles(path string, vFiles ast.VarsFiles, v mod.ParsedVarsFiles = vFiles - mod.VarsParsingErr = vErr - err = txn.Insert(s.tableName, mod) if err != nil { return err diff --git a/internal/state/module_test.go b/internal/state/module_test.go index 83b9e22b..cd39d6c8 100644 --- a/internal/state/module_test.go +++ b/internal/state/module_test.go @@ -493,7 +493,7 @@ dev = { err = s.Modules.UpdateParsedVarsFiles(tmpDir, ast.VarsFilesFromMap(map[string]*hcl.File{ "test.tfvars": testFile, - }), nil) + })) if err != nil { t.Fatal(err) } diff --git a/internal/terraform/module/module_ops.go b/internal/terraform/module/module_ops.go index ad8d12cc..262f97e9 100644 --- a/internal/terraform/module/module_ops.go +++ b/internal/terraform/module/module_ops.go @@ -508,7 +508,7 @@ func ParseVariables(ctx context.Context, fs ReadOnlyFS, modStore *state.ModuleSt return err } - sErr := modStore.UpdateParsedVarsFiles(modPath, files, err) + sErr := modStore.UpdateParsedVarsFiles(modPath, files) if sErr != nil { return sErr }