genkit-ai / genkit-ai/genkit

[Go] [Breaking Change] `Define*` functions should return concrete type instead of interface

Open
#4,100 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug go
Dominant language
TypeScript
Stars
6.5k
Forks
845
Avg merge
4d 4h
Merged PRs (30d)
58

Description

Describe the bug
Returning concrete types means callers will always have access to new methods exposed on it. Returning an interface means that adding a new function to it technically means it is a breaking change as users will not have it implemented in mocks, etc. Registry will continue to have to return interfaces on lookup.

This means that common interfaces ai.Tool, ai.Model, etc should be moved to the api subpackage.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the Go Define* functions and the common ai.Tool and ai.Model interfaces, then inspect how the api subpackage and registry lookups are structured. Determine the concrete return types and the interface placement needed for the breaking change; done means definitions expose concrete types while registry lookups continue returning interfaces.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.