Updates to the Go SDK - Questions, Feedback, Bug Fixes #2138
Pinned
mnafees
announced in
Announcements
Replies: 1 comment 2 replies
-
|
Hi @mnafees, First of all, thanks for this awesome improvement!
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone! 👋
We’ve just released a new version of the Go SDK as part of #2089.
We previously released the v1 Go SDK in April, but the initial feedback was that it was difficult to use, particularly with heavy reliance on generics. We felt that the feature clients were a step forward, but defining workflows and tasks were a step backwards. We took the opportunity when changing the package location to
/sdks/goto make some major improvements to the Go SDK, in particular reducing reliance on generics.📚 GoDoc: https://pkg.go.dev/github.com/hatchet-dev/hatchet/sdks/go
What the New
/sdks/goSDK AccomplishesNo More Heavy Generics
The biggest change is removing the complex generic types everywhere. In the old SDK, you had to write
workflow.WorkflowDeclaration[SimpleInput, SimpleResult]andcreate.WorkflowTask[DagInput, DagResult]with generics all over the place. The new SDK just uses simple functions likeworkflow.NewTask("name", func(ctx hatchet.Context, input MyStruct) (MyOutput, error))- much cleaner and easier to read.Simpler Workflow Creation
Creating workflows is now straightforward. Instead of the old
factory.NewWorkflow[InputType, OutputType](create.WorkflowCreateOpts[InputType]{...}, hatchet), you just writeclient.NewWorkflow("my-workflow"). No more factory patterns or complex option structs for basic workflows.Cleaner Task Dependencies
Setting up task dependencies is much simpler. The old SDK required you to define parents in the task options like create.WorkflowTask{Parents: []create.NamedTask{step1}}. Now you just add hatchet.WithParents(step1, step2) as a simple option when creating the task.
Direct Client Interface
Everything now starts from one client. Instead of getting a
v1.HatchetClientand then using factories, you createhatchet.NewClient()and call methods directly on it likeclient.NewWorkflow()andclient.NewWorker(). The API feels more natural and discoverable.Go-Style Functional Options
The new SDK uses Go's standard functional options pattern with
WithOption()functions. Instead of filling out big config structs, you can now write clean code likeclient.NewWorker("name", hatchet.WithWorkflows(wf1, wf2), hatchet.WithSlots(10))orworkflow.NewTask("task", fn, hatchet.WithRetries(3), hatchet.WithTimeout(30*time.Second)). This feels much more idiomatic to Go developers and makes the API self-documenting.These changes make the SDK much easier to learn and use without sacrificing any functionality.
How you can contribute
💡 If your bug is big enough to deserve its own issue, feel free to open it in the repo — and link it back here so we can keep the conversation in sync.
We’re excited to hear your feedback and ideas — this is your chance to shape the SDK before it’s stable! 🚀
Beta Was this translation helpful? Give feedback.
All reactions