configs: staticcheck
This commit is contained in:
parent
8925d94387
commit
82305bf1c8
|
@ -167,11 +167,9 @@ func (m *Module) ResourceByAddr(addr addrs.Resource) *Resource {
|
|||
func (m *Module) appendFile(file *File) hcl.Diagnostics {
|
||||
var diags hcl.Diagnostics
|
||||
|
||||
for _, constraint := range file.CoreVersionConstraints {
|
||||
// If there are any conflicting requirements then we'll catch them
|
||||
// when we actually check these constraints.
|
||||
m.CoreVersionConstraints = append(m.CoreVersionConstraints, constraint)
|
||||
}
|
||||
m.CoreVersionConstraints = append(m.CoreVersionConstraints, file.CoreVersionConstraints...)
|
||||
|
||||
m.ActiveExperiments = experiments.SetUnion(m.ActiveExperiments, file.ActiveExperiments)
|
||||
|
||||
|
@ -341,9 +339,7 @@ func (m *Module) mergeFile(file *File) hcl.Diagnostics {
|
|||
// would union together across multiple files anyway, but we'll
|
||||
// allow it and have each override file clobber any existing list.
|
||||
m.CoreVersionConstraints = nil
|
||||
for _, constraint := range file.CoreVersionConstraints {
|
||||
m.CoreVersionConstraints = append(m.CoreVersionConstraints, constraint)
|
||||
}
|
||||
m.CoreVersionConstraints = append(m.CoreVersionConstraints, file.CoreVersionConstraints...)
|
||||
}
|
||||
|
||||
if len(file.Backends) != 0 {
|
||||
|
|
|
@ -112,9 +112,7 @@ func (b mergeBody) prepareContent(base *hcl.BodyContent, override *hcl.BodyConte
|
|||
}
|
||||
content.Blocks = append(content.Blocks, block)
|
||||
}
|
||||
for _, block := range override.Blocks {
|
||||
content.Blocks = append(content.Blocks, block)
|
||||
}
|
||||
content.Blocks = append(content.Blocks, override.Blocks...)
|
||||
|
||||
return content
|
||||
}
|
||||
|
|
|
@ -38,16 +38,6 @@ func testParser(files map[string]string) *Parser {
|
|||
return NewParser(fs)
|
||||
}
|
||||
|
||||
// testModuleFromFile reads a single file, wraps it in a module, and returns
|
||||
// it. This is a helper for use in unit tests.
|
||||
func testModuleFromFile(filename string) (*Module, hcl.Diagnostics) {
|
||||
parser := NewParser(nil)
|
||||
f, diags := parser.LoadConfigFile(filename)
|
||||
mod, modDiags := NewModule([]*File{f}, nil)
|
||||
diags = append(diags, modDiags...)
|
||||
return mod, modDiags
|
||||
}
|
||||
|
||||
// testModuleConfigFrom File reads a single file from the given path as a
|
||||
// module and returns its configuration. This is a helper for use in unit tests.
|
||||
func testModuleConfigFromFile(filename string) (*Config, hcl.Diagnostics) {
|
||||
|
|
Loading…
Reference in New Issue