From 27fed4a1d85532de94a51be54f78f98b837f40fd Mon Sep 17 00:00:00 2001 From: Joshua Rich Date: Tue, 14 Jan 2025 22:39:12 +1000 Subject: [PATCH] fix: :fire: remove spew --- internal/cli/runCmd.go | 4 ---- internal/preferences/context.go | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/cli/runCmd.go b/internal/cli/runCmd.go index 7d1d20752..e7203dbbc 100644 --- a/internal/cli/runCmd.go +++ b/internal/cli/runCmd.go @@ -11,8 +11,6 @@ import ( "os/signal" "syscall" - "github.com/davecgh/go-spew/spew" - "github.com/joshuar/go-hass-agent/internal/agent" "github.com/joshuar/go-hass-agent/internal/hass" "github.com/joshuar/go-hass-agent/internal/logging" @@ -34,8 +32,6 @@ func (r *RunCmd) Run(opts *CmdOpts) error { ctx = preferences.PathToCtx(ctx, opts.Path) - spew.Dump(opts.Path) - // Load the preferences from file. Ignore the case where there are no // existing preferences. if err := preferences.Load(ctx, diff --git a/internal/preferences/context.go b/internal/preferences/context.go index 1dd41bbe1..0a623c21f 100644 --- a/internal/preferences/context.go +++ b/internal/preferences/context.go @@ -71,10 +71,13 @@ func MQTTPrefsFromFromCtx(ctx context.Context) *MQTT { return prefs } +// PathToCtx stores the base path for preferences (and other files) in the +// context. func PathToCtx(ctx context.Context, path string) context.Context { return context.WithValue(ctx, pathCtxKey, path) } +// PathFromCtx retrieves the base path for preferences from the context. func PathFromCtx(ctx context.Context) string { path, ok := ctx.Value(pathCtxKey).(string) if !ok {