From 119c679dd16d6a3c89b9d37665c44815956b6f82 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 12 May 2026 23:16:46 +0300 Subject: add compile-time interface satisfaction assertions for public types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add var _ Interface = (*ConcreteType)(nil) assertions for: - *flamegraph.LiveTrie → runtime.{Snapshotter,Configurator,LiveTrieSource} and tui/flamegraph.{Snapshotter,Configurator,LiveTrieSource} - *probemanager.Manager → runtime.ProbeManager - *statsengine.Engine → runtime.SnapshotSource - *streamrow.RingBuffer → runtime.EventSink - *runtimeBindings (tui) → runtime.TraceRuntimeBindings - *lateBoundDashboardSource → dashboard.SnapshotSource - libbpfTracepointProgram/Module → probemanager.{Program,Attacher} Assertions are grouped close to their interface definitions to avoid introducing new import cycles (runtime already imports all affected packages; tui/flamegraph already imports coreflamegraph). Co-Authored-By: Claude Sonnet 4.6 --- internal/tui/flamegraph/model.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'internal/tui/flamegraph') diff --git a/internal/tui/flamegraph/model.go b/internal/tui/flamegraph/model.go index 68ce7fd..73285f9 100644 --- a/internal/tui/flamegraph/model.go +++ b/internal/tui/flamegraph/model.go @@ -113,6 +113,19 @@ type LiveTrieSource interface { Configurator } +// --- compile-time interface satisfaction assertions --- +// +// *coreflamegraph.LiveTrie is the sole production implementation of all three +// trie interfaces. The assertions are placed here rather than in the +// flamegraph package itself to avoid an import cycle: runtime imports +// flamegraph, so flamegraph cannot import runtime. The tui/flamegraph package +// already imports coreflamegraph, making it the natural home. +var ( + _ Snapshotter = (*coreflamegraph.LiveTrie)(nil) + _ Configurator = (*coreflamegraph.LiveTrie)(nil) + _ LiveTrieSource = (*coreflamegraph.LiveTrie)(nil) +) + type zoomState struct { path string previousSelectedIdx int -- cgit v1.2.3