[BREAKING] Set stop_on_error default to true
⚠️ BREAKING CHANGE
This PR changes the default value of stop_on_error from false to true.
Impact
- Before: Air would continue running the last successful binary after build errors (silent failure)
- After: Air stops running the old binary when build errors occur (fail-fast behavior)
When stop_on_error is not configured, Air previously defaulted to false, causing it to silently run stale binaries after build failures. This leads to confusing debugging sessions where the build appears to succeed but the code changes are not reflected.
Changes
-
runner/config.go: SetStopOnError: trueindefaultConfig() -
runner/config_test.go: Add test verifying the default
Migration
Users who want the old behavior can explicitly set:
[build]
stop_on_error = false
Fixes #705
Original prompt
This section details on the original issue you should resolve
<issue_title>stop_on_error should be default true</issue_title> <issue_description>It seems that the default
[build].stop_on_errorparam (if not defined in .air.toml) is set to false?Is there any particular reason for it?
I just ended up debugging for 3+ hours where the build seemingly worked ok, until I dug deeper in my verbose output log. Using the "last known working binary" for hot-realoading and run it should not be the default imho.
Can this be changed? Thanks.
here's my current .air.toml if it is relevant.
# .air.toml # Root directory root = "." tmp_dir = "tmp" [build] # Command to build your project # Use .exe extension for Windows cmd = "swag init --parseDependency --parseInternal --parseDepth 1 && go build -o ./tmp/main.exe" # File extensions to watch for changes include_ext = ["go", "tpl", "tmpl", "html", "css", "js"] # Directories to exclude from watching exclude_dir = ["assets", "tmp", "vendor", "docs"] # Delay rebuild until changes have settled (in milliseconds) delay = 1000 # Additional build flags (optional) build_flags = "-v" # Add this line to stop running the app on build error stop_on_error = true [run] # Command to run your built binary # Use .exe extension for Windows cmd = "./tmp/main.exe" # Environment variables to set when running the binary env = ["APP_ENV=development"] [color] main = "yellow" watcher = "cyan" build = "green" runner = "magenta"</issue_description>
Comments on the Issue (you are @copilot in this section)
- Fixes air-verse/air#705
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
@copilot should note this is a breaking change
@copilot should note this is a breaking change
Updated the PR description to clearly mark this as a breaking change with ⚠️ BREAKING CHANGE header, impact details, and migration instructions for users who want to keep the old behavior.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
| Files with missing lines | Coverage Δ | |
|---|---|---|
| runner/config.go | 73.80% <100.00%> (+0.09%) |
:arrow_up: |
... and 2 files with indirect coverage changes
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.