Files
yellowjacket/backend/explore/servicestartup.go
T
logan b98840ee37 fix(build): keep the index tools free of the Wails application
The v3 migration put application.Get() in backend/events and a
ServiceStartup hook in backend/explore, both of which cmd/indexbuild
reaches. v3's application package is GTK/WebKit bindings on Linux, so
the index-artifact job — a plain golang container with CGO_ENABLED=0,
on the stated grounds that neither command imports the app — stopped
compiling with "undefined: pointer". That job owns the ~205 GB dump
checkpoint, so it is the worst place to learn this.

Both are behind the indexbuild tag now: the one app.Event.Emit lives in
runtime_wails.go, runtime_indexbuild.go answers ErrNoRuntime (what the
app itself returns before Run, so Deliver's callers need no second
path), and explore's ServiceStartup moves to its own tagged file.

TestIndexToolsDoNotImportWails walks `go list -deps -tags indexbuild`
so the claim the workflow makes is checked rather than assumed.
2026-08-16 14:51:01 -04:00

31 lines
909 B
Go

//go:build !indexbuild
package explore
import (
"context"
"github.com/wailsapp/wails/v3/pkg/application"
)
// ServiceStartup is v3's service lifecycle hook: it runs once the
// runtime exists, and ctx is cancelled when the app shuts down. It
// replaces v2's SetContext, which had to be called by hand from
// OnStartup and was exported, so it was also bound to the frontend.
//
// It is the one thing in this package that names the Wails application,
// and it is behind a build tag for the reason
// backend/events/runtime_wails.go states: cmd/indexbuild imports this
// package and is built without cgo, GTK or WebKit. Nothing under the
// indexbuild tag runs a Wails app, so the hook — and the context it
// installs — is simply absent there.
func (e *Service) ServiceStartup(
ctx context.Context,
_ application.ServiceOptions,
) error {
e.ctx = ctx
e.index.SetContext(ctx)
return nil
}