Skip to content

Debug output is unable to print command names #1015

Open
@aieri

Description

@aieri

Describe the bug
When invoking debug logging for command checks I would expect the output to include the check name and resemble what was shown in #816 (comment).
In place of the check name I see %!s(<nil>) instead.

How To Reproduce

Given a goss.yaml as follows:

command:
  foo:
    exec: echo "this is a test"
    exit-status: 0

Expected Behavior

$ goss -l debug v
2025-01-24T20:54:31Z [DEBUG] Setting log level to DEBUG
2025-01-24T20:54:31Z [DEBUG][Command][foo][stdout]  this is a test
2025-01-24T20:54:31Z [DEBUG][Command][foo][stdout]  
.

Total Duration: 0.002s
Count: 1, Failed: 0, Skipped: 0
2025-01-24T20:54:31Z [DEBUG] OK SUMMARY: Total Duration: 0.002s Count: 1, Failed: 0, Skipped: 0 

Actual Behavior

$ goss -l debug v
2025-01-24T20:56:04Z [DEBUG] Setting log level to DEBUG
2025-01-24T20:56:04Z [DEBUG][Command][%!s(<nil>)][stdout]  this is a test
2025-01-24T20:56:04Z [DEBUG][Command][%!s(<nil>)][stdout]  
.

Total Duration: 0.002s
Count: 1, Failed: 0, Skipped: 0
2025-01-24T20:56:04Z [DEBUG] OK SUMMARY: Total Duration: 0.002s Count: 1, Failed: 0, Skipped: 0 

Environment:

  • Version of goss: goss version v0.4.9
  • OS/Distribution version (if applicable): Ubuntu 24.04.1 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions