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

fix: skip cleanup if build is skipped #83

Merged
merged 1 commit into from
Feb 19, 2022
Merged

fix: skip cleanup if build is skipped #83

merged 1 commit into from
Feb 19, 2022

Conversation

mohammed90
Copy link
Member

@mohammed90 mohammed90 commented Feb 18, 2022

The env var XCADDY_SKIP_BUILD is supposed to imply XCADDY_SKIP_CLEANUP, but the implementation missed this detail. The Builder#Build method has defer buildEnv.Close(), which runs even on the early exit here:

xcaddy/builder.go

Lines 80 to 86 in c795956

defer buildEnv.Close()
if b.SkipBuild {
log.Printf("[INFO] Skipping build as requested")
return nil
}

The environment#Close method does not know about (Builder).SkipBuild. We can overload the skipCleanup semantics because skipping build implies skipping cleanup.

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thank you! Elegant fix. Didn't think about that defer.

@mholt mholt merged commit 996c8d9 into master Feb 19, 2022
@mholt mholt deleted the fix-skip-build branch February 19, 2022 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants