Thank you for your interest in contributing to gotui! We strive for A+ Code Quality and have strict guidelines to maintain a clean, performant, and maintainable codebase.
- Modern Go: Use Go 1.20+ idioms.
- No Comments: Code must be self-explanatory. Use clear variable/function names and logic instead of comments. Comments are treated as a failure to write clear code.
- Strict Typing: Always use specific types. Avoid
interface{}/anyunless absolutely necessary. - Low Complexity: Keep functions simple. Cyclomatic complexity must remain under 15. Split large functions.
- Backward Compatibility: changes MUST NOT break existing global APIS (
ui.Init(),ui.Render(), etc.).
types.go: All shared/core types (InitConfig,Event,Drawable, etc.) belong here.backend.go: Encapsulatestcellspecifics.widgets/: All widgets go in this package._examples/: Examples live here (underscored to avoid import bloat).
-
Fork & Clone:
git clone https://github.com/metaspartan/gotui.git cd gotui -
Make Changes: Implement your feature or fix.
-
Verify Quality:
- Format code:
gofmt -s -w . - Check complexity:
gocyclo -over 15 .(Install viago install github.com/fzipp/gocyclo/cmd/gocyclo@latest) - Ensure no linter warnings.
- Format code:
-
Test:
- Run the dashboard example:
go run _examples/dashboard/main.go - Run the SSH example (if touching backend):
go run _examples/ssh-dashboard/main.go
- Run the dashboard example:
-
Submit PR: Open a Pull Request with a clear description of your changes.
Please report bugs via GitHub Issues. Include:
gotuiversion- Terminal emulator used
- Minimal reproduction snippet
Thank you for helping make gotui the best TUI library for Go! 🚀