Skip to content

Commit

Permalink
minor improvement in Collection.String()
Browse files Browse the repository at this point in the history
  • Loading branch information
muir committed Mar 15, 2022
1 parent 5567ba2 commit 601b8c8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nject.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,11 @@ func (c Collection) string(indent string) string {
var buf strings.Builder
_, _ = buf.WriteString(indent + c.name + ":\n")
for _, fm := range c.contents {
_, _ = buf.WriteString(fmt.Sprintf("%s %T\n", indent, fm.fn))
if s, ok := fm.fn.(interface{ String() string }); ok {
_, _ = buf.WriteString(indent + s.String())
} else {
_, _ = buf.WriteString(fmt.Sprintf("%s %T\n", indent, fm.fn))
}
}
return buf.String()
}
Expand Down

0 comments on commit 601b8c8

Please sign in to comment.