English Version | 中文版本
Repository: https://github.com/zte-riscv/go
This specification applies to the Go RISC-V code repository jointly maintained by ZTE and ByteDance. We are committed to enhancing Golang support for RISC-V architecture, regularly contributing code upstream to golang/go while synchronizing with its latest features.
We warmly welcome community developers to participate! Whether it's fixing bugs, implementing new features, or improving documentation, your contributions will help advance the RISC-V ecosystem.
To ensure efficient collaboration, please review the following guidelines before submitting code:
Download the corresponding version from the GitHub Releases page, selecting the version suitable for your system architecture (e.g., linux-riscv64.tar.gz).
The naming rules for versions are:go version number+version release date "YYYYMM", separated by '.', for example: 1.25.3.202512. The version release cycle is one month.
Extract the downloaded archive to the target directory:
# Extract to a specified directory (e.g., /usr/local)
tar -C /usr/local -xzf go1.xx.x.linux-riscv64.tar.gzConfigure the GOROOT environment variable to point to the Go installation directory:
Method 1: Temporary Configuration (valid for current session)
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/binMethod 2: Permanent Configuration (Recommended)
Add the following to ~/.bashrc or ~/.bash_profile:
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/binThen execute source ~/.bashrc to apply the configuration.
Method 3: System-wide Configuration
Edit /etc/profile or /etc/environment and add the above environment variable configuration.
After installation, verify with the following command:
go versionIf configured correctly, it will display output similar to go version go1.xx.x linux/riscv64.
Unlike Go/Golang, this version of the toolchain provides an optional extension configuration feature via the GORISCV64 environment variable. When specific extensions are specified, the compiler will generate assembly instructions corresponding to these extensions in certain scenarios, to achieve optimal performance.
Usage: GORISCV64=[,]...
Example: GORISCV64=rva23u64,zacas,zabha
The currently supported optional extensions are Zacas and Zabha.
Mandatory:
- Create or claim a related Issue before commencing substantive work
- Clearly describe the change motivation, design approach, and expected impact in the Issue
Recommended:
- For significant changes (e.g., new instruction set support, architectural modifications), submit a design document for prior review
# Create a feature branch from the current development branch (e.g., go1.25.6-zte-dev):
git fetch origin
git checkout -b your_dev_branch origin/go1.25.6-zte-devIssue Submission:
- For bug reports: Document the problem, environment, and reproduction steps
- For features/optimizations: Describe the technical background and implementation strategy
Pull Request Submission:
- Provide task context in the PR description and reference related Issues
- Resolve all merge conflicts locally before submission
CI and Review:
- Automated test suites will execute upon PR submission (failed tests block merging)
- Require approvals from designated reviewers before merging, reviewers comment +1 or +2.
Merge Policy:
- All commits must be squashed into a single commit
For squashed commits, follow this format:
git commit -m "package: concise change summary
Fixes #12345
Updates #67890"- Header: Package prefix + brief description (<50 chars)
- Footer: Issue references
- CI pipeline must pass
- Minimum approvals:
- One +2 from ZTE core maintainers
- One +2 from ByteDance core maintainers
+1: Preliminary approval (requires additional reviewer)+2: Final approval for merging
For maintainers and reviewers: when approving the merge, please respond with either +1 or +2.
| GitHub | Role | Org | Auth Level |
|---|---|---|---|
| @agiledragon | Maintainer | ZTE | +2 |
| @ctk-1998 | Reviewer | ZTE | +1 |
| @lxq015 | Reviewer | ZTE | +1 |
| @hehongjun20110618 | Maintainer | ZTE | +2 |
| @newborn22 | Maintainer | ZTE | +2 |
| @wenchangping | Reviewer | ZTE | +1 |
| @wangpc-pp | Maintainer | ByteDance | +2 |
| @BoyaoWang430 | Reviewer | ByteDance | +1 |
- ✅ Go coding standards compliance
- ✅ Passing CI pipelines
- ✅ Corresponding test coverage
- ✅ Performance benchmarks (where applicable)
- Static Analysis: Run
go veton all modified code packages - Codegen Validation: Verify RISCV64 instruction generation via
asmcheck(go/test/codegen/) - Assembly Tests: Validate machine code output from assembly instructions (
go/src/cmd/asm/internal/asm/testdata/riscv64.s) - Regression Testing: Execute
go/src/all.bashon x86/ARM architectures - Application Testing: Validate test file execution in QEMU-RISCV environment (
go/test/zte/*_test.go)
For performance-sensitive changes:
Test Environment:
- Hardware: [e.g., SiFive Unmatched, VisionFive2]
- Go Version:
- Test Date:
- CPU (Optional): [Cores, frequency, RISC-V extensions]
- Memory (Optional):Benchmark Results, benchstat comparison:
benchstat old.txt new.txt
name old time/op new time/op delta
Fibonacci 125ms ± 2% 98ms ± 3% -21.60% (p=0.000 n=10+10)
Sort 456ms ± 1% 401ms± 2% -12.06% (p=0.000 n=9+10)
Official Go Contribution Guide: https://golang.org/doc/contribute