From 3b84e86cd43728f9bcab4bcee4531346fde42c15 Mon Sep 17 00:00:00 2001 From: Todd Treece Date: Tue, 6 Feb 2024 22:50:24 -0500 Subject: [PATCH] gofmt updates --- internal/wire/parse.go | 6 +++--- internal/wire/wire_test.go | 1 - wire.go | 36 ++++++++++++++++++------------------ 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/internal/wire/parse.go b/internal/wire/parse.go index 93fbda85..09f1e1dd 100644 --- a/internal/wire/parse.go +++ b/internal/wire/parse.go @@ -1173,9 +1173,9 @@ func (pt ProvidedType) IsNil() bool { // // - For a function provider, this is the first return value type. // - For a struct provider, this is either the struct type or the pointer type -// whose element type is the struct type. -// - For a value, this is the type of the expression. -// - For an argument, this is the type of the argument. +// whose element type is the struct type. +// - For a value, this is the type of the expression. +// - For an argument, this is the type of the argument. func (pt ProvidedType) Type() types.Type { return pt.t } diff --git a/internal/wire/wire_test.go b/internal/wire/wire_test.go index 96861a15..6389ac6d 100644 --- a/internal/wire/wire_test.go +++ b/internal/wire/wire_test.go @@ -463,7 +463,6 @@ type testCase struct { // program_out.txt // expected output from the final compiled program, // missing if wire_errs.txt is present -// func loadTestCase(root string, wireGoSrc []byte) (*testCase, error) { name := filepath.Base(root) pkg, err := ioutil.ReadFile(filepath.Join(root, "pkg")) diff --git a/wire.go b/wire.go index fe8edc8c..6af91dda 100644 --- a/wire.go +++ b/wire.go @@ -156,12 +156,12 @@ type StructProvider struct{} // // For example: // -// type S struct { -// MyFoo *Foo -// MyBar *Bar -// } -// var Set = wire.NewSet(wire.Struct(new(S), "MyFoo")) -> inject only S.MyFoo -// var Set = wire.NewSet(wire.Struct(new(S), "*")) -> inject all fields +// type S struct { +// MyFoo *Foo +// MyBar *Bar +// } +// var Set = wire.NewSet(wire.Struct(new(S), "MyFoo")) -> inject only S.MyFoo +// var Set = wire.NewSet(wire.Struct(new(S), "*")) -> inject all fields func Struct(structType interface{}, fieldNames ...string) StructProvider { return StructProvider{} } @@ -175,22 +175,22 @@ type StructFields struct{} // // The following example would provide Foo and Bar using S.MyFoo and S.MyBar respectively: // -// type S struct { -// MyFoo Foo -// MyBar Bar -// } +// type S struct { +// MyFoo Foo +// MyBar Bar +// } // -// func NewStruct() S { /* ... */ } -// var Set = wire.NewSet(wire.FieldsOf(new(S), "MyFoo", "MyBar")) +// func NewStruct() S { /* ... */ } +// var Set = wire.NewSet(wire.FieldsOf(new(S), "MyFoo", "MyBar")) // -// or +// or // -// func NewStruct() *S { /* ... */ } -// var Set = wire.NewSet(wire.FieldsOf(new(*S), "MyFoo", "MyBar")) +// func NewStruct() *S { /* ... */ } +// var Set = wire.NewSet(wire.FieldsOf(new(*S), "MyFoo", "MyBar")) // -// If the structType argument is a pointer to a pointer to a struct, then FieldsOf -// additionally provides a pointer to each field type (e.g., *Foo and *Bar in the -// example above). +// If the structType argument is a pointer to a pointer to a struct, then FieldsOf +// additionally provides a pointer to each field type (e.g., *Foo and *Bar in the +// example above). func FieldsOf(structType interface{}, fieldNames ...string) StructFields { return StructFields{} }