From fd0f3ed6cb749cba87c71f5e6c5531ce74ffc797 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Wed, 20 Dec 2017 00:09:17 +0200 Subject: [PATCH] fix check for singleton on fillStruct - no problem let's set all the static values on the first value although it may never be needed if request-scoped/stateless (No Singleton di.State) Former-commit-id: a72bcd720d900fdc009cabb1e4a0b455026710fd --- mvc/di/struct.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mvc/di/struct.go b/mvc/di/struct.go index 27c19f62..0d077aff 100644 --- a/mvc/di/struct.go +++ b/mvc/di/struct.go @@ -143,7 +143,7 @@ func (s *StructInjector) fillStruct() { // if field is Static then set it to the value that passed by the caller, // so will have the static bindings already and we can just use that value instead // of creating new instance. - if s.State == Singleton && f.Object.BindType == Static { + if f.Object.BindType == Static { destElem.FieldByIndex(f.FieldIndex).Set(f.Object.Value) } }