We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 9aea7a2 + 73f95eb commit 8822b07Copy full SHA for 8822b07
inject.go
@@ -121,7 +121,7 @@ func (inj *injector) Apply(val interface{}) error {
121
for i := 0; i < v.NumField(); i++ {
122
f := v.Field(i)
123
structField := t.Field(i)
124
- if f.CanSet() && structField.Tag == "inject" {
+ if f.CanSet() && (structField.Tag == "inject" || structField.Tag.Get("inject") != "") {
125
ft := f.Type()
126
v := inj.Get(ft)
127
if !v.IsValid() {
inject_test.go
@@ -10,7 +10,7 @@ type SpecialString interface {
10
}
11
12
type TestStruct struct {
13
- Dep1 string `inject`
+ Dep1 string `inject:"t" json:"-"`
14
Dep2 SpecialString `inject`
15
Dep3 string
16
0 commit comments