-
Notifications
You must be signed in to change notification settings - Fork 7
go-tui: Go SDK Quickstart #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Update go.mod to use local Go SDK development path - Replace identity-based initialization with Config-based API - Migrate from SetTransportConfig to UpdateTransportConfig pattern - Add CODEOWNERS entry for go-tui directory maintenance This migration prepares the go-tui application for Ditto v5 compatibility while maintaining all existing functionality.
- Add context support for graceful cancellation - Replace sleep hack with synchronous initial query - Implement robust error handling with time.AfterFunc - Simplify mutex patterns with proper RWMutex usage - Add non-blocking channel operations with select/ctx.Done - Document all improvements in GO_IMPROVEMENTS.md - Enhance goroutine lifecycle management
- Update main.go to use DittoAuthenticator with token provider pattern - Replace legacy manual authentication with AuthenticationProvider interface - Add proper authentication status handling and token refresh logic - Implement demo token provider for testing authentication workflow - Update imports to use new authenticator types from Go SDK This update aligns the TUI demo with the latest Go SDK authentication patterns and provides a working example of the new auth system.
- Update imports to use single ditto package instead of nested packages - Change from ditto/presence to ditto for PeerPresenceObserver - Compatible with SDK refactoring that flattened package structure
- Updated config initialization to use DittoConfig type - Aligns with recent SDK refactoring in go-sdk
…ndConnect Updated main.go to use the new ServerConnect API instead of the deprecated OnlinePlaygroundConnect type, following the Go SDK's removal of deprecated APIs.
- Replace deprecated OnlinePlaygroundConnect with ServerConnect - Add platform-specific stderr redirection (Unix/Windows compatible) - Switch from RUST_LOG environment variable to Ditto Logger API - Redirect logs to temp file to prevent terminal UI interference - Add go fmt formatting fixes - Confirm observer callbacks functionality - Add golang.org/x/sys and golang.org/x/term dependencies
- Fixed terminal initialization to properly show UI components - Removed debug logging statements that cluttered output - Cleaned up temporary test file handling - Application now displays correctly in terminal
- Remove DisableSyncWithV3() call from main initialization - Function has been removed from Go SDK - No longer needed for v4+ SDK compatibility
- Change Authenticator() to Auth() method calls - Remove error assignment from SetExpirationHandler (now infallible)
- Changed ServerConnect type to DittoConfigConnectServer to match renamed type in Go SDK v5 - Maintains consistency with other DittoConfig connection types
Update StartSync() call to use d.Sync().Start() to match the refactored Go SDK API where sync methods have been moved from Ditto to Sync type.
- Clear the RowStyles map so the previous selection is removed. - termui.Table.TextStyle is used as the default style for rows not in the RowStyles map.
The main task table was also making room for the input box when in edit/create modes, but no room is needed since the input box is rendered over the task table.
In edit mode, it was not possible to type the letter "q" because the
main event loop was swallowing the event. This event switch was
over-complicated anyway, and pushing all these cases down into
handleEvent/handle{Normal,Input}Mode lets them serve their purpose
better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new Go Terminal User Interface (TUI) application for managing tasks with Ditto's real-time sync capabilities. The application provides a terminal-based task manager with create, edit, delete, and completion toggle functionality, synchronized across multiple peers using the Ditto Go SDK.
Key changes:
- Complete Go TUI application with task management features (CRUD operations, real-time sync)
- Platform-specific stderr redirection to prevent TUI corruption (Unix and Windows implementations)
- Build system with Makefile that handles Ditto SDK library downloads and platform-specific configuration
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| go-tui/main.go | Core application logic with event loop, UI rendering, and Ditto integration |
| go-tui/widgets.go | Helper function for creating borderless paragraphs for small UI elements |
| go-tui/redirect_unix.go | Unix-specific stderr redirection to /dev/null |
| go-tui/redirect_windows.go | Windows-specific terminal detection (stderr redirection not yet implemented) |
| go-tui/go.mod | Go module definition with dependencies |
| go-tui/go.sum | Dependency checksums |
| go-tui/Makefile | Build system for downloading SDK and building the application |
| go-tui/README.md | Comprehensive documentation with setup instructions and troubleshooting |
| go-tui/.gitignore | Git ignore rules for build artifacts and logs |
| go-tui/.editorconfig | Editor configuration for Go files |
| .github/CODEOWNERS | Code ownership assignments for the new go-tui directory |
Comments suppressed due to low confidence (1)
go-tui/redirect_unix.go:29
- File handle may be writable as a result of data flow from a call to OpenFile and closing it may result in data loss upon failure, which is not handled explicitly.
defer devNull.Close()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…lts in older builds
skylerjokiel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
![]()
Go TUI Quickstart app
Based on original Claude translation of the rust-tui (#128), and updated with final Go SDK APIs and bug fixes.
Closes SDKS-1804
Note that there is no 4.x version of the Go SDK, so at this time it's not appropriate to add it to our auto-version-update scripts.