From c6424e9569cd62631343869cf7f20bc513b8ed26 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 9 Oct 2014 16:12:30 -0700 Subject: [PATCH] config: make the replace function marginally more understandable --- config/interpolate_walk.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/interpolate_walk.go b/config/interpolate_walk.go index 6ff995bf0..281ab229c 100644 --- a/config/interpolate_walk.go +++ b/config/interpolate_walk.go @@ -210,8 +210,8 @@ func (w *interpolationWalker) removeCurrent() { w.unknownKeys = append(w.unknownKeys, strings.Join(w.key, ".")) } -func (w *interpolationWalker) replace(v reflect.Value, offset int) { - c := w.cs[len(w.cs)-1+offset] +func (w *interpolationWalker) replaceCurrent(v reflect.Value) { + c := w.cs[len(w.cs)-2] switch c.Kind() { case reflect.Map: // Get the key and delete it @@ -273,5 +273,5 @@ func (w *interpolationWalker) splitSlice() { // Our slice is now done, we have to replace the slice now // with this new one that we have. - w.replace(reflect.ValueOf(result), -1) + w.replaceCurrent(reflect.ValueOf(result)) }