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

Ensure non-nil debugwriter for easier v2v migration #249

Merged
merged 2 commits into from
Jul 24, 2023

Conversation

BarDweller
Copy link
Contributor

Some testcases are driving code that uses logger.debugWriter() when debug has not been enabled, this currently leads to a nil writer being returning, which causes code panics within the debug calls. This is an indirect side effect of the choice to move from a struct in the v1 poet logger, to an interface within the v2 logger. Many testcases do not initialize a logger, and run without debug being set, and yet end up driving code that attempts to log debug messages. Mostly these are ok when logged via the log.Debug* methods, but if the writer is obtained directly then panics can occur when the nil is dereferenced.

Rather than chasing down every testcase individually, it seems safer to return a no-op writer when debug is disabled.

Added two testcases to check new behavior.

Signed-off-by: Ozzy Osborne <bardweller@gmail.com>
Signed-off-by: Ozzy Osborne <bardweller@gmail.com>
@dmikusa dmikusa added type:bug A general bug semver:patch A change requiring a patch version bump labels Jul 24, 2023
@dmikusa dmikusa merged commit 19d8814 into buildpacks:main Jul 24, 2023
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:patch A change requiring a patch version bump type:bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants