Add extensive test coverage, demo program, and CI integration for
//export with different names feature:
Unit Tests (cl/builtin_test.go):
- TestHandleExportDiffName: core functionality with 4 scenarios
* Different names with enableExportRename
* Same names with enableExportRename
* Different names with spaces in export directive
* Matching names without enableExportRename
- TestInitLinknameByDocExportDiffNames: flag behavior verification
* Export with different names when enabled
* Export with same name when enabled
* Normal linkname directives
- TestInitLinkExportDiffNames: edge case handling
* Symbol not found in decl packages (silent handling)
Demo (_demo/embed/export/):
- Example program demonstrating various export patterns
- Verification script testing both embedded and non-embedded targets
- Documents expected behavior and error cases
CI Integration (.github/workflows/llgo.yml):
- Add export demo to embedded target tests
- Ensure feature works correctly across platforms
- Catch regressions in future changes
The tests verify:
✓ Different names work with -target flag
✓ Same names work in all cases
✓ Different names fail without -target flag
✓ Proper error messages for invalid exports
✓ Silent handling for decl packages
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add z_rt_default.go with signal handler for SIGSEGV on non-wasm platforms
- Convert segmentation faults from nil pointer access to Go panic
- Enable recover() to catch nil pointer dereference errors
- Use build tag (!wasm) to maintain wasm platform compatibility
- Remove commented-out signal handling code from z_rt.go
This aligns llgo's behavior with standard Go, where accessing nil pointer
fields triggers a recoverable panic instead of immediate program crash.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Moved test from _cmptest/reflect_indirect/ to _demo/go/reflect-indirect/
- Refactored to use panic() for validation instead of fmt.Println
- Added proper assertions for all test cases
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
Enhanced the demo test to cover comprehensive import scenarios:
- Test 1: build.Default context with GOOS/GOARCH validation
- Test 2: Standard library package import (fmt)
- Test 3: Nested standard library package (os/exec)
- Test 4: Internal package import (internal/cpu)
- Test 5: Runtime package with Dir validation
- Test 6: ImportDir with current directory
- Test 7: IsLocalImport with multiple path formats
- Test 8: Context GOPATH/GOROOT validation
- Test 9: Import with AllowBinary flag
- Test 10: Release tags validation
All tests include proper result validation to ensure go/build
patches work correctly across different use cases.
🤖 Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
Enhanced the demo test to cover more go/build functionality:
- build.Import (existing)
- build.ImportDir (new)
- build.IsLocalImport (new)
- build.Default context verification (existing, improved)
This ensures the go/build patches work correctly across different
public functions, not just Import.
Also ran go fmt to fix formatting issues reported by CI.
🤖 Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
- Created zcgo.go with defaultCGO_ENABLED constant (Go 1.24 pattern)
- Updated parseGoVersion to panic on unexpected input instead of fallback
- Added runtime.(*Func).Name stub to symtab.go for Go 1.21/1.22 compatibility
- Removed go1.23 build constraint from demo
- Removed internal/buildcfg package (replaced by zcgo.go)
These changes ensure the demo works across Go 1.21+ versions.
🤖 Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
- Link internal/buildcfg.ToolTags variable instead of hardcoding tool tags
- Add comprehensive test cases in demo.go to verify:
- build.Default.Compiler is correctly patched to "gc"
- ToolTags are properly populated from internal/buildcfg
- ReleaseTags are correctly generated
- Validates the go/build patches work as expected
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add //go:build go1.23 constraint to skip compilation on Go 1.21/1.22
where runtime.(*Func).Name is not implemented in llgo, causing linker
errors when internal/bisect is pulled in as a dependency.
The demo works correctly on Go 1.23+ where the dependency chain or
internal/bisect behavior avoids calling the unimplemented method.
Fixes compatibility issue reported in PR review.
🤖 Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
- Moved full overlay file from runtime/_overlay/go/build/build.go to
runtime/internal/go/build/build.go to make it clearer what's being overridden
- Updated runtime/overlay.go to embed from new location
- Created demo under _demo/go/gobuild to demonstrate go/build package working with llgo
- The overlay still contains the full file but is now organized under runtime/internal
following the project's pattern for patched standard library packages
Fixes#1346
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
- Fix line 67: Change unused variable 'n' to blank identifier '_'
- Fix line 102: Correct WriteByte call to expect only error return value
(WriteByte returns only error, not (int, error))
These fixes resolve the compilation errors reported by the CI.
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
- Add tests for all major hash/maphash public APIs:
* Hash basics (WriteString, Sum64, Reset)
* MakeSeed and SetSeed functionality
* Write methods (Write, WriteByte, WriteString)
* Bytes and String convenience functions
- Use panic() for unexpected errors instead of silent failures
- Add proper error checking and validation
- Document Comparable/WriteComparable limitations in overlay
Note: Comparable() and WriteComparable() are not yet supported and will
panic with 'intrinsic' error as they require runtime intrinsic support.
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>