I'm trying to initialize the Dagger client as a reusable function when using the Go SDK.
func InitializeDagger(ctx context.Context) dagger.Client {
client, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stdout))
if err != nil {
panic(err)
}
defer client.Close()
return client
}
// Calling above function
ctx := context.Background()
client := common.InitializeDagger(ctx)
Unfortunately, I run into the error below - has anyone seen this before? I feel like I'm overlooking something simple 😅
panic: Post "http://dagger/query": dial tcp 127.0.0.1:54527: connectex: No connection could be made because the target machine actively refused it.