Skip to content

Commit

Permalink
[Go] make core the home of codegen (#245)
Browse files Browse the repository at this point in the history
Move the go:generate lines into core/core.go

Make core the default package for codegen.

Delete genkit/gen.go; no generated types live there.
  • Loading branch information
jba authored May 24, 2024
1 parent 43fe9bd commit 282a6b4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 26 deletions.
7 changes: 7 additions & 0 deletions go/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Run the npm script that generates JSON Schemas from the zod types
// in the *.ts files. It writes the result to genkit-tools/genkit-schema.json
//go:generate npm --prefix ../../genkit-tools run export:schemas

// Run the Go code generator on the file just created.
//go:generate go run ../internal/cmd/jsonschemagen -outdir .. -config schemas.config ../../genkit-tools/genkit-schema.json core

// Package core implements Genkit actions, flows and other essential machinery.
// This package is primarily intended for genkit internals and for plugins.
// Applications using genkit should use the genkit package.
Expand Down
2 changes: 0 additions & 2 deletions go/genkit/schemas.config → go/core/schemas.config
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,10 @@ FlowInvokeEnvelopeMessageRunScheduled omit
Operation omit

FlowStateExecution name flowExecution
FlowStateExecution pkg core
FlowStateExecution.startTime type gtime.Milliseconds
FlowStateExecution.endTime type gtime.Milliseconds

FlowError name flowError
FlowError pkg core

GenerateRequest.messages doc
Messages is a list of messages to pass to the model. The first n-1 Messages
Expand Down
17 changes: 0 additions & 17 deletions go/genkit/gen.go

This file was deleted.

7 changes: 0 additions & 7 deletions go/genkit/genkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Run the npm script that generates JSON Schemas from the zod types
// in the *.ts files. It writes the result to genkit-tools/genkit-schema.json
//go:generate npm --prefix ../../genkit-tools run export:schemas

// Run the Go code generator on the file just created.
//go:generate go run ../internal/cmd/jsonschemagen -outdir .. -config schemas.config ../../genkit-tools/genkit-schema.json genkit

// Package genkit provides Genkit functionality for application developers.
package genkit

Expand Down

0 comments on commit 282a6b4

Please sign in to comment.