fix lint errors
Some checks failed
Lint / golangci-lint (push) Successful in 10m26s
Declarative Tests / test (push) Failing after 22s
Declarative Tests / build-fedora (push) Failing after 2m1s
Declarative Tests / build-ubuntu-focal (push) Successful in 1m49s

This commit is contained in:
Matthew Rich 2024-09-27 03:58:14 +00:00
parent d815419c7b
commit a6fe8fe799
2 changed files with 3 additions and 8 deletions

View File

@ -316,7 +316,9 @@ func (a *App) ConfigCmd(docs []string, includeSystemConfig bool) (err error) {
} }
if includeSystemConfig { if includeSystemConfig {
_, err = a.emitter.Emit(a.Config, nil) if _, err = a.emitter.Emit(a.Config, nil); err != nil {
return
}
} }
_, err = a.emitter.(data.ManyEmitter).EmitMany(a.Documents, nil) _, err = a.emitter.(data.ManyEmitter).EmitMany(a.Documents, nil)
return return

View File

@ -275,12 +275,7 @@ func (d *Document) Apply(state string) error {
slog.Info("Document.Apply() applying resource", "index", idx, "uri", d.ResourceDeclarations[idx].Resource().URI(), "resource", d.ResourceDeclarations[idx].Resource()) slog.Info("Document.Apply() applying resource", "index", idx, "uri", d.ResourceDeclarations[idx].Resource().URI(), "resource", d.ResourceDeclarations[idx].Resource())
if d.ResourceDeclarations[idx].Requires.Check() { if d.ResourceDeclarations[idx].Requires.Check() {
// fmt.Fprintf(os.Stderr, "%s: ", d.ResourceDeclarations[idx].Resource().URI())
if e := d.ResourceDeclarations[idx].Apply(state); e != nil { if e := d.ResourceDeclarations[idx].Apply(state); e != nil {
// slog.Error("Document.Apply() error applying resource", "index", idx, "uri", d.ResourceDeclarations[idx].Resource().URI(), "error", e)
// fmt.Fprintf(os.Stderr, "%s\n", "error")
d.ResourceDeclarations[idx].Error = e.Error() d.ResourceDeclarations[idx].Error = e.Error()
switch d.ResourceDeclarations[idx].OnError.GetStrategy() { switch d.ResourceDeclarations[idx].OnError.GetStrategy() {
case OnErrorStop: case OnErrorStop:
@ -288,8 +283,6 @@ func (d *Document) Apply(state string) error {
case OnErrorFail: case OnErrorFail:
d.failedResources++ d.failedResources++
} }
} else {
// fmt.Fprintf(os.Stderr, "%s\n", state)
} }
} else { } else {
d.ResourceDeclarations[idx].Error = fmt.Sprintf("Constraint failure: %s", d.ResourceDeclarations[idx].Requires) d.ResourceDeclarations[idx].Error = fmt.Sprintf("Constraint failure: %s", d.ResourceDeclarations[idx].Requires)