Contributing to trzsz-go
We warmly welcome contributions to the trzsz-go ecosystem! Whether you are squashing a bug, proposing an enhancement, or expanding our test coverage, your effort makes a difference.
This guide outlines the development environment setup, architectural philosophy, and pull request process.
Development Prerequisites
To build and test trzsz-go locally, ensure you have the following installed:
- Go Toolkit: Version
1.25or higher is strictly required as we utilize modern Go standard library features. - Make: GNU Make is used to orchestrate builds and tests via the provided
Makefile. - Git: For version control.
Setting up the Environment
- Fork the repository on GitHub.
-
Clone your fork locally:
git clone https://github.com/<your-username>/trzsz-go.git cd trzsz-go -
Ensure all dependencies are fetched and validated:
go mod tidy
Project Architecture
Understanding the repository layout will help you navigate the codebase efficiently:
cmd/: Contains themainpackages for the CLI executables. These are extremely thin wrappers that parse CLI arguments and pass them to the core library.cmd/trz/main.go: Entrypoint for remote upload command.cmd/tsz/main.go: Entrypoint for remote download command.cmd/trzsz/main.go: Entrypoint for the local client wrapper.
trzsz/: The core library. This is where the magic happens.filter.go: TheTrzszFilterlogic that intercepts PTY streams.pipeline.go: Highly concurrent data streaming, encoding, and MD5 hashing logic for fast file transfers.comm.go&transfer.go: Handshake protocols and#DATA:/#SUCC:acknowledgment logic.tmuxcc.go: Specialized logic for parsingtmuxControl Mode (-CC) escaping.zmodem.go: Legacylrzszfallback integration.
examples/: Contains thessh_client.gosample code illustrating how to embed the Go API.
Building the Binaries
You can compile all executables (trz, tsz, trzsz) simultaneously using the Makefile:
make all
The compiled binaries will be output to the local ./bin directory.
To clean up artifacts:
make clean
Testing Philosophy
We maintain strict test coverage to ensure terminal integrity is never broken across varying OS environments. It is crucial that all tests pass before submitting a Pull Request.
Execute the test suite using:
make test
This executes go test -v -count=1 ./trzsz.
Note: The test suite includes simulated terminal buffer reading (buffer_test.go), chunked pipeline encoding checks (pipeline_test.go), and rigorous regex parsing validation for Zmodem and Tmux CC intercepts.
Submitting a Pull Request
- Branching: Create a new, descriptively named branch for your feature or bugfix (
git checkout -b feature/osc52-improvements). - Coding: Write your code. If you are adding a feature or fixing a parsing bug, you must add a corresponding test case in the
*_test.gofiles. - Testing: Ensure
make testpasses successfully locally. - Committing: Use clear, concise commit messages.
- Pushing: Push your branch to your fork (
git push origin feature/osc52-improvements). - Pull Request: Open a Pull Request against the
mainbranch of the upstream repository. Describe the problem you are solving and link to any relevant issues.
Continuous Integration (CI)
We use GitHub Actions (.github/workflows/gotest.yml). Every push and pull request is automatically built and tested across Ubuntu, macOS, and Windows environments. PRs will not be merged if the CI pipeline fails.