Skip to content

fix(config): restore the go:generate directive so make generate works - #152

Open
c1-squire-dev[bot] wants to merge 1 commit into
mainfrom
c1-squire-dev/fix-config-go-generate
Open

fix(config): restore the go:generate directive so make generate works#152
c1-squire-dev[bot] wants to merge 1 commit into
mainfrom
c1-squire-dev/fix-config-go-generate

Conversation

@c1-squire-dev

@c1-squire-dev c1-squire-dev Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

One line. pkg/config has no //go:generate directive, so the Makefile's

$(GENERATED_CONF): pkg/config/config.go go.mod
	@echo "Generating $(GENERATED_CONF)..."
	go generate ./pkg/config

is a silent no-op — it prints Generating pkg/config/conf.gen.go... and regenerates nothing. Running the generator directly instead (go run ./pkg/config/gen) does work, but the SDK's generator is os.Create("conf.gen.go"), relative to the working directory, so the file lands in the repo root and has to be moved by hand.

A //go:generate directive runs with the working directory set to the package, which fixes both halves at once.

This repo is the outlier: baton-datadog, baton-okta, baton-github and baton-slack all carry the same //go:generate go run ./gen line in pkg/config/config.go, against an otherwise byte-identical Makefile rule.

Verification

$ rm -f conf.gen.go && make generate
Generating pkg/config/conf.gen.go...
go generate ./pkg/config

$ git status --porcelain
 M pkg/config/config.go

conf.gen.go is regenerated in place, byte for byte identical to what was committed, and nothing is left in the repo root. The only change in the tree is this file's one added line.

Scope

config_schema.json and baton_capabilities.json are deliberately left alone. They are generated from the built binary rather than from config.go, so they move when the SDK moves — commit 85111b92 here rewrote 92 lines of baton_capabilities.json off a dependency bump with no config change at all. That is why generate-baton-metadata.yaml regenerates and commits them on merge to main, and why no connector's Makefile emits them. Adding them to a local target would produce files that go stale on the next SDK bump with nobody touching the repo.

pkg/config had no //go:generate directive, so the Makefile's
"go generate ./pkg/config" was a silent no-op and make generate never
regenerated conf.gen.go. Running the generator by hand instead
("go run ./pkg/config/gen") writes conf.gen.go relative to the working
directory, so it landed in the repo root and had to be moved.

A go:generate directive runs with the working directory set to the package,
which fixes both halves at once. baton-datadog, baton-okta, baton-github and
baton-slack all carry the same line; this repo is the outlier.

make generate now reproduces the committed conf.gen.go byte for byte.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Connector PR Review: fix(config): restore the go:generate directive so make generate works

Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 168682264c66.
Review mode: full
View review run: https://github.com/ConductorOne/baton-snowflake/actions/runs/32989061987

Review Summary

Scanned the full PR diff for security and correctness: it is a single added //go:generate go run ./gen line in pkg/config/config.go. Verified the directive resolves correctly — go generate runs with the working directory set to pkg/config, so ./gen matches the existing pkg/config/gen/gen.go (package main, calling config.Generate with the snowflake configuration), and the SDK generator writes conf.gen.go relative to that directory, which is exactly the path the Makefile generate target expects. No duplicate directive exists elsewhere in the repo, pkg/config/conf.gen.go is untouched, no dependency manifests changed, and there is no import cycle since gen is a separate main package. No issues found.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

None.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found.

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