From 119a0d115be5417a31583d539f7e5010ce490557 Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Thu, 27 Sep 2018 14:58:03 +1000 Subject: [PATCH] Ensure context bindings are used for Run(). --- callbacks.go | 3 ++- context.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/callbacks.go b/callbacks.go index 112d35a..7f4637b 100644 --- a/callbacks.go +++ b/callbacks.go @@ -23,10 +23,11 @@ func (b bindings) clone() bindings { return out } -func (b bindings) merge(other bindings) { +func (b bindings) merge(other bindings) bindings { for k, v := range other { b[k] = v } + return b } func getMethod(value reflect.Value, name string) reflect.Value { diff --git a/context.go b/context.go index 201ce16..2b6dbbb 100644 --- a/context.go +++ b/context.go @@ -501,7 +501,7 @@ func (c *Context) Run(bindings ...interface{}) (err error) { if err != nil { return err } - binds := c.Kong.bindings.clone().add(bindings...).add(c) + binds := c.Kong.bindings.clone().add(bindings...).add(c).merge(c.bindings) return callMethod("Run", node.Target, method, binds) }