The genMainModule function never returns an error, so simplified
its signature to return only Package.
Updated:
- genMainModule signature: (Package, error) -> Package
- Call site in build.go to not handle error
- Both test cases to remove error checking
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: cpunion <8459+cpunion@users.noreply.github.com>
The original code incorrectly used the stdout null check condition
for both stdout and stderr pointer selection. This caused incorrect
behavior when stderr is null but stdout is not, or vice-versa.
This fix separates the null checks for stdout and stderr into
independent conditions, ensuring each stream is properly selected
based on its own null status.
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: cpunion <8459+cpunion@users.noreply.github.com>
- For library modes (c-archive, c-shared), only generate minimal code with __llgo_argc/__llgo_argv globals
- For executable mode, generate full main function with runtime initialization
- This fixes undefined symbol errors when linking libraries that reference these globals
- Add BuildMode type with three build modes: exe, c-archive, c-shared
- Restrict buildmode flag to llgo build command only (not run/install/test)
- Implement build mode specific linker arguments:
- c-shared: use -shared -fPIC flags
- c-archive: use ar tool to create static archive
- exe: default executable mode
- Add normalizeOutputPath function for platform-specific file naming conventions
- Generate C header files for library modes
- Fix buildmode flag conflict by removing from PassArgs
- Add comprehensive test coverage for all build modes
- Resolve duplicate logic between defaultAppExt and normalizeOutputPath
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add support for -file-format flag to llgo build command allowing users to specify output format independently of target configuration.
Changes:
- Add -file-format flag supporting bin, hex, elf, uf2, zip formats
- Implement two-stage conversion: firmware format → file format
- Add ConvertOutput function with hex format conversion support
- Update build logic to handle different modes (build vs run/install)
- Add verbose logging for conversion operations
For build command: only convert firmware when -file-format is specified
For run/install commands: always convert firmware when target requires it
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>