Skip to content

Implement Go SDK#1

Open
bettercallsaulj wants to merge 9 commits intomainfrom
dev_go_sdk
Open

Implement Go SDK#1
bettercallsaulj wants to merge 9 commits intomainfrom
dev_go_sdk

Conversation

@bettercallsaulj
Copy link
Copy Markdown
Collaborator

No description provided.

RahulHere added 9 commits January 23, 2026 02:15
- Remove C++ files: .clang-format, cmake/, CMakeLists.txt, Makefile,
  src/, include/, examples/, tests/, build.sh
- Remove C++ CI workflow (pr-format-check.yml)
- Update submodule from gopher-mcp to gopher-orch (commit 6b45ffbb)
- Update .gitignore for Go development
Build script that:
- Updates submodules with SSH URL rewrite support
- Handles 'update = none' in gopher-orch/.gitmodules
- Builds gopher-orch native library with CMake
- Copies dependency libraries (gopher-mcp, fmt)
- Builds Go SDK with CGO
- Runs Go tests

Usage:
  ./build.sh                    # Full build
  ./build.sh --clean            # Clean build artifacts
  GITHUB_SSH_HOST=alias ./build.sh  # Use custom SSH host
Go SDK implementation with:
- CGO bindings to gopher-orch native library (gopherorch/ffi/library.go)
- GopherAgent with Create, Run, RunDetailed, Close methods
- GopherAgentConfig with builder pattern
- AgentResult with status tracking
- Error types: AgentError, APIKeyError, ConnectionError, TimeoutError
- Unit tests for config and result types
- Add client_example_json.go demonstrating GopherAgent usage
- Add client_example_json_run.sh to run example with local servers
- Include server3001 (weather tools) and server3002 (time/password tools)
Tests for the CGO FFI bindings to verify correct native library integration:

FFI Tests (gopherorch/ffi/library_test.go):
- Test library availability check
- Test agent creation with JSON config
- Test agent creation with empty config
- Test agent creation with API key
- Test error handling functions
- Test API fetch servers
- Test nil handle handling

Integration Tests (gopherorch/agent_test.go):
- Test initialization and shutdown
- Test agent creation with server config
- Test agent close idempotency
- Test run after close returns error
- Test runDetailed returns result
- Test multiple agents can be created
- Test nil/empty config handling
Add complete SDK documentation including:
- Project overview and architecture
- Build and installation instructions
- Quick start guide with code examples
- API reference for all public types
- Project structure explanation
- Troubleshooting guide for common issues
Fix two issues that caused test failures:

1. macOS dylib @rpath issue: Libraries had @rpath install names
   that couldn't be resolved at runtime. Added install_name_tool
   commands to build.sh to fix library IDs and references.

2. Malformed Go files in submodule: The gopher-mcp submodule
   contains incomplete Go files that break the Go compiler.
   Added go.mod creation in build.sh to exclude the submodule
   from the parent Go module discovery.
Rename the Go package directory from gopherorch to src:
- Rename gopherorch/ to src/
- Update package declarations from 'package gopherorch' to 'package src'
- Update all import paths in Go files
- Update README.md with new package name and paths
- Update example file import
Document Go code formatting and linting commands:
- go fmt ./... for formatting
- go vet ./... for static analysis
- Test command with library path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant