From 0e369e6df83b5ecbf94c17b3f9ff9b444a4084ca Mon Sep 17 00:00:00 2001 From: BorisBorshevsky Date: Wed, 13 Dec 2017 15:27:32 +0200 Subject: [PATCH] fix bug --- router.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/router.go b/router.go index 2f5d2eae..11cb4aa8 100644 --- a/router.go +++ b/router.go @@ -201,9 +201,12 @@ func (p *ControllerRegister) addWithMethodParams(pattern string, c ControllerInt numOfFields := elemVal.NumField() for i := 0; i < numOfFields; i++ { - fieldVal := elemVal.Field(i) fieldType := elemType.Field(i) - execElem.FieldByName(fieldType.Name).Set(fieldVal) + + if execElem.FieldByName(fieldType.Name).CanSet() { + fieldVal := elemVal.Field(i) + execElem.FieldByName(fieldType.Name).Set(fieldVal) + } } return execController