mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
plans/objchange: Fix go vet warnings
Passing the result of fmt.Sprintf as the format string to path.NewErrorf is redundant. It can also potentially cause problems if the result would also contain formatting verbs, although in this case the input is under this function's full control so this was just a waste of time rather than a behavior problem. Go error strings also conventionally start with lowercase letters and act as sentence fragments rather than full sentences, so the prefix used for a zero-length path is now "root object" instead of "Root object". Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
This commit is contained in:
parent
c1f1008723
commit
e70913a609
@ -36,15 +36,15 @@ func assertObjectCompatible(schema *configschema.Block, planned, actual cty.Valu
|
||||
var errs []error
|
||||
var atRoot string
|
||||
if len(path) == 0 {
|
||||
atRoot = "Root object "
|
||||
atRoot = "root object "
|
||||
}
|
||||
|
||||
if planned.IsNull() && !actual.IsNull() {
|
||||
errs = append(errs, path.NewErrorf(fmt.Sprintf("%swas absent, but now present", atRoot)))
|
||||
errs = append(errs, path.NewErrorf("%swas absent, but now present", atRoot))
|
||||
return errs
|
||||
}
|
||||
if actual.IsNull() && !planned.IsNull() {
|
||||
errs = append(errs, path.NewErrorf(fmt.Sprintf("%swas present, but now absent", atRoot)))
|
||||
errs = append(errs, path.NewErrorf("%swas present, but now absent", atRoot))
|
||||
return errs
|
||||
}
|
||||
if planned.IsNull() {
|
||||
|
Loading…
Reference in New Issue
Block a user