Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module: remove deadcode for parsing error #1708

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions internal/state/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ type Module struct {
ParsedModuleFiles ast.ModFiles
ParsedVarsFiles ast.VarsFiles
ModuleParsingErr error
VarsParsingErr error

Meta ModuleMetadata
MetaErr error
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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()

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/state/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/terraform/module/module_ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See L507, the err always nil

if sErr != nil {
return sErr
}
Expand Down