Skip to content

Commit 37b5cae

Browse files
committed
add Unused
1 parent f3d93df commit 37b5cae

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

api.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,3 +579,11 @@ func (c *Collection) MustSetCallback(binderFunction interface{}) {
579579
panic(DetailedError(err))
580580
}
581581
}
582+
583+
type unused struct{}
584+
585+
// Unused is value that a function that returns injectors can return that will never be
586+
// included in an injection chain. Unused can be used in situations where you want to
587+
// call a function as part of generating a list of injectors and functions in such a list
588+
// must have a return value.
589+
var Unused = Provide("unused", unused{})

bind_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ func TestLiteral(t *testing.T) {
305305
counts := make(map[string]int)
306306
c := Sequence("TBF",
307307
s1("s1 value"),
308+
func() Provider {
309+
return Unused
310+
}(),
308311
Cacheable(func(s s1) s2 {
309312
counts["s2"]++
310313
assert.Equal(t, s1("s1 value"), s)

0 commit comments

Comments
 (0)