Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobOaks committed May 14, 2024
1 parent 38cf1f3 commit 985c1ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions annotated.go
Original file line number Diff line number Diff line change
Expand Up @@ -1177,33 +1177,33 @@ func As(interfaces ...interface{}) Annotation {
//
// fx.Provide(
// fx.Annotate(
// bytes.NewBuffer,
// fx.As(new(io.Writer)),
// fx.As(fx.Self()),
// )
// bytes.NewBuffer,
// fx.As(new(io.Writer)),
// fx.As(fx.Self()),
// )
// )
//
// Is equivalent to,
//
// fx.Provide(
// bytes.NewBuffer,
// func(b *bytes.Buffer) io.Writer {
// return b
// },
// )
// fx.Provide(
// bytes.NewBuffer,
// func(b *bytes.Buffer) io.Writer {
// return b
// },
// )
//
// in that it provides the same *bytes.Buffer instance
// as both a *bytes.Buffer and an io.Writer.
func Self() any {
return &_self{}
return &self{}
}

type _self struct{}
type self struct{}

func (at *asAnnotation) apply(ann *annotated) error {
at.types = make([]asType, len(at.targets))
for i, typ := range at.targets {
if _, ok := typ.(*_self); ok {
if _, ok := typ.(*self); ok {
at.types[i] = asType{self: true}
continue
}
Expand Down
2 changes: 1 addition & 1 deletion annotated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ func TestAnnotatedAs(t *testing.T) {
fx.In

S1 fmt.Stringer `name:"goodStringer"`
S2 *asStringer `name:"goodStringer"`
S2 *asStringer `name:"goodStringer"`
}
type myStringer interface {
String() string
Expand Down

0 comments on commit 985c1ee

Please sign in to comment.