diff --git a/go.mod b/go.mod index 806db0e..ab54eee 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/sebdah/goldie/v2 v2.5.5 github.com/stretchr/testify v1.9.0 golang.org/x/tools v0.21.0 - gopkg.in/yaml.v2 v2.4.0 + gopkg.in/yaml.v3 v3.0.1 ) require ( @@ -19,5 +19,5 @@ require ( golang.org/x/mod v0.17.0 // indirect golang.org/x/sync v0.7.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/internal/gen_test.go b/internal/gen_test.go index b5c6d57..20f5bbf 100644 --- a/internal/gen_test.go +++ b/internal/gen_test.go @@ -17,7 +17,7 @@ import ( "github.com/luno/jettison/log" "github.com/sebdah/goldie/v2" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" ) //go:generate go test -update diff --git a/internal/testdata/dev_exchange_tpldata.golden b/internal/testdata/dev_exchange_tpldata.golden index 25bdc0c..76c9e42 100644 --- a/internal/testdata/dev_exchange_tpldata.golden +++ b/internal/testdata/dev_exchange_tpldata.golden @@ -3,136 +3,136 @@ tags: "" backendstype: exchange_ops.Backends backendsname: Backends imports: - example/exchange: - name: exchange - pkgpath: example/exchange - aliased: false - example/exchange/db: - name: exchange_db - pkgpath: example/exchange/db - aliased: true - example/exchange/ops: - name: exchange_ops - pkgpath: example/exchange/ops - aliased: true - example/exchange/state: - name: exchange_state - pkgpath: example/exchange/state - aliased: true - example/external/versioned: - name: versioned - pkgpath: example/external/versioned - aliased: false - example/external/versioned/v1: - name: versioned_v1 - pkgpath: example/external/versioned/v1 - aliased: true - example/identity/email: - name: email - pkgpath: example/identity/email - aliased: false - example/identity/email/client/dev: - name: email_client_dev - pkgpath: example/identity/email/client/dev - aliased: true - example/identity/email/client/logical: - name: email_client_logical - pkgpath: example/identity/email/client/logical - aliased: true - example/identity/email/db: - name: email_db - pkgpath: example/identity/email/db - aliased: true - example/identity/users: - name: users - pkgpath: example/identity/users - aliased: false - example/identity/users/client/dev: - name: users_client_dev - pkgpath: example/identity/users/client/dev - aliased: true - example/identity/users/client/logical: - name: users_client_logical - pkgpath: example/identity/users/client/logical - aliased: true - example/identity/users/db: - name: users_db - pkgpath: example/identity/users/db - aliased: true + example/exchange: + name: exchange + pkgpath: example/exchange + aliased: false + example/exchange/db: + name: exchange_db + pkgpath: example/exchange/db + aliased: true + example/exchange/ops: + name: exchange_ops + pkgpath: example/exchange/ops + aliased: true + example/exchange/state: + name: exchange_state + pkgpath: example/exchange/state + aliased: true + example/external/versioned: + name: versioned + pkgpath: example/external/versioned + aliased: false + example/external/versioned/v1: + name: versioned_v1 + pkgpath: example/external/versioned/v1 + aliased: true + example/identity/email: + name: email + pkgpath: example/identity/email + aliased: false + example/identity/email/client/dev: + name: email_client_dev + pkgpath: example/identity/email/client/dev + aliased: true + example/identity/email/client/logical: + name: email_client_logical + pkgpath: example/identity/email/client/logical + aliased: true + example/identity/email/db: + name: email_db + pkgpath: example/identity/email/db + aliased: true + example/identity/users: + name: users + pkgpath: example/identity/users + aliased: false + example/identity/users/client/dev: + name: users_client_dev + pkgpath: example/identity/users/client/dev + aliased: true + example/identity/users/client/logical: + name: users_client_logical + pkgpath: example/identity/users/client/logical + aliased: true + example/identity/users/db: + name: users_db + pkgpath: example/identity/users/db + aliased: true params: [] deps: -- type: email.Client - var: email - getter: Email - isduplicate: false - provider: - funcpkg: email_client_dev - funcname: Make - returnserr: true - params: - - '&b' - errwrapmsg: email client dev make -- type: '*email_db.EmailDB' - var: emailDB - getter: EmailDB - isduplicate: false - provider: - funcpkg: email_db - funcname: Connect - returnserr: true - params: [] - errwrapmsg: email db connect -- type: '*exchange_db.ExchangeDB' - var: exchangeDB - getter: ExchangeDB - isduplicate: false - provider: - funcpkg: exchange_db - funcname: Connect - returnserr: true - params: [] - errwrapmsg: exchange db connect -- type: chan<- exchange.Model - var: modelChan - getter: ModelChan - isduplicate: false - provider: - funcpkg: exchange_state - funcname: NewModelChan - returnserr: false - params: [] - errwrapmsg: exchange state new model chan -- type: users.Client - var: users - getter: Users - isduplicate: false - provider: - funcpkg: users_client_dev - funcname: Make - returnserr: true - params: - - '&b' - errwrapmsg: users client dev make -- type: '*users_db.UsersDB' - var: usersDB - getter: UsersDB - isduplicate: false - provider: - funcpkg: users_db - funcname: Connect - returnserr: true - params: [] - errwrapmsg: users db connect -- type: '*versioned_v1.Service' - var: versioned - getter: Versioned - isduplicate: false - provider: - funcpkg: versioned - funcname: New - returnserr: false - params: [] - errwrapmsg: versioned new + - type: email.Client + var: email + getter: Email + isduplicate: false + provider: + funcpkg: email_client_dev + funcname: Make + returnserr: true + params: + - '&b' + errwrapmsg: email client dev make + - type: '*email_db.EmailDB' + var: emailDB + getter: EmailDB + isduplicate: false + provider: + funcpkg: email_db + funcname: Connect + returnserr: true + params: [] + errwrapmsg: email db connect + - type: '*exchange_db.ExchangeDB' + var: exchangeDB + getter: ExchangeDB + isduplicate: false + provider: + funcpkg: exchange_db + funcname: Connect + returnserr: true + params: [] + errwrapmsg: exchange db connect + - type: chan<- exchange.Model + var: modelChan + getter: ModelChan + isduplicate: false + provider: + funcpkg: exchange_state + funcname: NewModelChan + returnserr: false + params: [] + errwrapmsg: exchange state new model chan + - type: users.Client + var: users + getter: Users + isduplicate: false + provider: + funcpkg: users_client_dev + funcname: Make + returnserr: true + params: + - '&b' + errwrapmsg: users client dev make + - type: '*users_db.UsersDB' + var: usersDB + getter: UsersDB + isduplicate: false + provider: + funcpkg: users_db + funcname: Connect + returnserr: true + params: [] + errwrapmsg: users db connect + - type: '*versioned_v1.Service' + var: versioned + getter: Versioned + isduplicate: false + provider: + funcpkg: versioned + funcname: New + returnserr: false + params: [] + errwrapmsg: versioned new transbcks: -- email_client_logical.Backends -- users_client_logical.Backends + - email_client_logical.Backends + - users_client_logical.Backends diff --git a/internal/testdata/dev_identity_tpldata.golden b/internal/testdata/dev_identity_tpldata.golden index a930b83..6a0aa60 100644 --- a/internal/testdata/dev_identity_tpldata.golden +++ b/internal/testdata/dev_identity_tpldata.golden @@ -3,152 +3,152 @@ tags: "" backendstype: identity_state.Backends backendsname: Backends imports: - example/exchange: - name: exchange - pkgpath: example/exchange - aliased: false - example/exchange/client/dev: - name: exchange_client_dev - pkgpath: example/exchange/client/dev - aliased: true - example/exchange/client/logical: - name: exchange_client_logical - pkgpath: example/exchange/client/logical - aliased: true - example/exchange/db: - name: exchange_db - pkgpath: example/exchange/db - aliased: true - example/external/mail: - name: mail - pkgpath: example/external/mail - aliased: false - example/external/mail/mail: - name: mail_mail - pkgpath: example/external/mail/mail - aliased: true - example/identity/email: - name: email - pkgpath: example/identity/email - aliased: false - example/identity/email/client/dev: - name: email_client_dev - pkgpath: example/identity/email/client/dev - aliased: true - example/identity/email/client/logical: - name: email_client_logical - pkgpath: example/identity/email/client/logical - aliased: true - example/identity/email/db: - name: email_db - pkgpath: example/identity/email/db - aliased: true - example/identity/state: - name: identity_state - pkgpath: example/identity/state - aliased: true - example/identity/users: - name: users - pkgpath: example/identity/users - aliased: false - example/identity/users/client/dev: - name: users_client_dev - pkgpath: example/identity/users/client/dev - aliased: true - example/identity/users/client/logical: - name: users_client_logical - pkgpath: example/identity/users/client/logical - aliased: true - example/identity/users/db: - name: users_db - pkgpath: example/identity/users/db - aliased: true + example/exchange: + name: exchange + pkgpath: example/exchange + aliased: false + example/exchange/client/dev: + name: exchange_client_dev + pkgpath: example/exchange/client/dev + aliased: true + example/exchange/client/logical: + name: exchange_client_logical + pkgpath: example/exchange/client/logical + aliased: true + example/exchange/db: + name: exchange_db + pkgpath: example/exchange/db + aliased: true + example/external/mail: + name: mail + pkgpath: example/external/mail + aliased: false + example/external/mail/mail: + name: mail_mail + pkgpath: example/external/mail/mail + aliased: true + example/identity/email: + name: email + pkgpath: example/identity/email + aliased: false + example/identity/email/client/dev: + name: email_client_dev + pkgpath: example/identity/email/client/dev + aliased: true + example/identity/email/client/logical: + name: email_client_logical + pkgpath: example/identity/email/client/logical + aliased: true + example/identity/email/db: + name: email_db + pkgpath: example/identity/email/db + aliased: true + example/identity/state: + name: identity_state + pkgpath: example/identity/state + aliased: true + example/identity/users: + name: users + pkgpath: example/identity/users + aliased: false + example/identity/users/client/dev: + name: users_client_dev + pkgpath: example/identity/users/client/dev + aliased: true + example/identity/users/client/logical: + name: users_client_logical + pkgpath: example/identity/users/client/logical + aliased: true + example/identity/users/db: + name: users_db + pkgpath: example/identity/users/db + aliased: true params: [] deps: -- type: email.Client - var: email - getter: Email - isduplicate: false - provider: - funcpkg: email_client_dev - funcname: Make - returnserr: true - params: - - '&b' - errwrapmsg: email client dev make -- type: '*email_db.EmailDB' - var: emailDB - getter: EmailDB - isduplicate: false - provider: - funcpkg: email_db - funcname: Connect - returnserr: true - params: [] - errwrapmsg: email db connect -- type: exchange.Client - var: exchange - getter: Exchange - isduplicate: false - provider: - funcpkg: exchange_client_dev - funcname: Make - returnserr: true - params: - - '&b' - errwrapmsg: exchange client dev make -- type: '*exchange_db.ExchangeDB' - var: exchangeDB - getter: ExchangeDB - isduplicate: false - provider: - funcpkg: exchange_db - funcname: Connect - returnserr: true - params: [] - errwrapmsg: exchange db connect -- type: '*mail.Mailer' - var: mailer - getter: Mailer - isduplicate: false - provider: - funcpkg: mail - funcname: New - returnserr: true - params: [] - errwrapmsg: mail new -- type: '*mail_mail.MailerLegacy' - var: mailerLegacy - getter: MailerLegacy - isduplicate: false - provider: - funcpkg: mail_mail - funcname: New - returnserr: true - params: [] - errwrapmsg: mail new -- type: users.Client - var: users - getter: Users - isduplicate: false - provider: - funcpkg: users_client_dev - funcname: Make - returnserr: true - params: - - '&b' - errwrapmsg: users client dev make -- type: '*users_db.UsersDB' - var: usersDB - getter: UsersDB - isduplicate: false - provider: - funcpkg: users_db - funcname: Connect - returnserr: true - params: [] - errwrapmsg: users db connect + - type: email.Client + var: email + getter: Email + isduplicate: false + provider: + funcpkg: email_client_dev + funcname: Make + returnserr: true + params: + - '&b' + errwrapmsg: email client dev make + - type: '*email_db.EmailDB' + var: emailDB + getter: EmailDB + isduplicate: false + provider: + funcpkg: email_db + funcname: Connect + returnserr: true + params: [] + errwrapmsg: email db connect + - type: exchange.Client + var: exchange + getter: Exchange + isduplicate: false + provider: + funcpkg: exchange_client_dev + funcname: Make + returnserr: true + params: + - '&b' + errwrapmsg: exchange client dev make + - type: '*exchange_db.ExchangeDB' + var: exchangeDB + getter: ExchangeDB + isduplicate: false + provider: + funcpkg: exchange_db + funcname: Connect + returnserr: true + params: [] + errwrapmsg: exchange db connect + - type: '*mail.Mailer' + var: mailer + getter: Mailer + isduplicate: false + provider: + funcpkg: mail + funcname: New + returnserr: true + params: [] + errwrapmsg: mail new + - type: '*mail_mail.MailerLegacy' + var: mailerLegacy + getter: MailerLegacy + isduplicate: false + provider: + funcpkg: mail_mail + funcname: New + returnserr: true + params: [] + errwrapmsg: mail new + - type: users.Client + var: users + getter: Users + isduplicate: false + provider: + funcpkg: users_client_dev + funcname: Make + returnserr: true + params: + - '&b' + errwrapmsg: users client dev make + - type: '*users_db.UsersDB' + var: usersDB + getter: UsersDB + isduplicate: false + provider: + funcpkg: users_db + funcname: Connect + returnserr: true + params: [] + errwrapmsg: users db connect transbcks: -- exchange_client_logical.Backends -- email_client_logical.Backends -- users_client_logical.Backends + - exchange_client_logical.Backends + - email_client_logical.Backends + - users_client_logical.Backends diff --git a/internal/testdata/duplicate_tpldata.golden b/internal/testdata/duplicate_tpldata.golden index 24a80a3..182b6c3 100644 --- a/internal/testdata/duplicate_tpldata.golden +++ b/internal/testdata/duplicate_tpldata.golden @@ -5,24 +5,24 @@ backendsname: Backends imports: {} params: [] deps: -- type: FooSomething - var: foo - getter: Foo - isduplicate: false - provider: - funcpkg: "" - funcname: FooProvider - returnserr: false - params: [] - errwrapmsg: duplicate state foo provider -- type: FooSomething - var: foo - getter: GetFoo - isduplicate: true - provider: - funcpkg: "" - funcname: FooProvider - returnserr: false - params: [] - errwrapmsg: duplicate state foo provider + - type: FooSomething + var: foo + getter: Foo + isduplicate: false + provider: + funcpkg: "" + funcname: FooProvider + returnserr: false + params: [] + errwrapmsg: duplicate state foo provider + - type: FooSomething + var: foo + getter: GetFoo + isduplicate: true + provider: + funcpkg: "" + funcname: FooProvider + returnserr: false + params: [] + errwrapmsg: duplicate state foo provider transbcks: [] diff --git a/internal/testdata/example/duplicate/state/backends_gen.go b/internal/testdata/example/duplicate/state/backends_gen.go deleted file mode 100644 index 06a1ebb..0000000 --- a/internal/testdata/example/duplicate/state/backends_gen.go +++ /dev/null @@ -1,8 +0,0 @@ -package state - -// Code generated by weld. DO NOT EDIT. - -type Backends interface { - Foo() FooSomething - GetFoo() FooSomething -} diff --git a/internal/testdata/example/duplicate/state/weld_gen.go b/internal/testdata/example/duplicate/state/weld_gen.go deleted file mode 100644 index 266980a..0000000 --- a/internal/testdata/example/duplicate/state/weld_gen.go +++ /dev/null @@ -1,27 +0,0 @@ -//go:build !dev - -package state - -// Code generated by weld. DO NOT EDIT. - -func MakeBackends() (Backends, error) { - var ( - b backendsImpl - ) - - b.foo = FooProvider() - - return &b, nil -} - -type backendsImpl struct { - foo FooSomething -} - -func (b *backendsImpl) Foo() FooSomething { - return b.foo -} - -func (b *backendsImpl) GetFoo() FooSomething { - return b.foo -} diff --git a/internal/testdata/example/no_err/state/backends_gen.go b/internal/testdata/example/no_err/state/backends_gen.go deleted file mode 100644 index b9dd48b..0000000 --- a/internal/testdata/example/no_err/state/backends_gen.go +++ /dev/null @@ -1,7 +0,0 @@ -package state - -// Code generated by weld. DO NOT EDIT. - -type Backends interface { - Foo() bool -} diff --git a/internal/testdata/example/no_err/state/weld_gen.go b/internal/testdata/example/no_err/state/weld_gen.go deleted file mode 100644 index 23fc603..0000000 --- a/internal/testdata/example/no_err/state/weld_gen.go +++ /dev/null @@ -1,23 +0,0 @@ -//go:build !dev - -package state - -// Code generated by weld. DO NOT EDIT. - -func MakeBackends() (Backends, error) { - var ( - b backendsImpl - ) - - b.foo = foo() - - return &b, nil -} - -type backendsImpl struct { - foo bool -} - -func (b *backendsImpl) Foo() bool { - return b.foo -} diff --git a/internal/testdata/example/samevar/state/backends_gen.go b/internal/testdata/example/samevar/state/backends_gen.go deleted file mode 100644 index 42bd35d..0000000 --- a/internal/testdata/example/samevar/state/backends_gen.go +++ /dev/null @@ -1,12 +0,0 @@ -package state - -// Code generated by weld. DO NOT EDIT. - -import ( - "example/samevar/pool" -) - -type Backends interface { - GetPool() *pool.BarPool - Pool() *pool.FooPool -} diff --git a/internal/testdata/example/samevar/state/weld_gen.go b/internal/testdata/example/samevar/state/weld_gen.go deleted file mode 100644 index c8bb61f..0000000 --- a/internal/testdata/example/samevar/state/weld_gen.go +++ /dev/null @@ -1,32 +0,0 @@ -package state - -// Code generated by weld. DO NOT EDIT. - -import ( - "example/samevar/pool" -) - -func MakeBackends() (Backends, error) { - var ( - b backendsImpl - ) - - b.pool = pool.NewBarPool() - - b.pool1 = pool.NewFooPool() - - return &b, nil -} - -type backendsImpl struct { - pool *pool.BarPool - pool1 *pool.FooPool -} - -func (b *backendsImpl) GetPool() *pool.BarPool { - return b.pool -} - -func (b *backendsImpl) Pool() *pool.FooPool { - return b.pool1 -} diff --git a/internal/testdata/example/sort_with_bind/state/backends_gen.go b/internal/testdata/example/sort_with_bind/state/backends_gen.go deleted file mode 100644 index cd19290..0000000 --- a/internal/testdata/example/sort_with_bind/state/backends_gen.go +++ /dev/null @@ -1,13 +0,0 @@ -package state - -// Code generated by weld. DO NOT EDIT. - -import ( - "example/sort_with_bind" -) - -type Backends interface { - GetFoo() sort_with_bind.Foo - GetBar() sort_with_bind.Bar - GetBaz() sort_with_bind.Baz -} diff --git a/internal/testdata/example/sort_with_bind/state/weld_gen.go b/internal/testdata/example/sort_with_bind/state/weld_gen.go deleted file mode 100644 index 07464ce..0000000 --- a/internal/testdata/example/sort_with_bind/state/weld_gen.go +++ /dev/null @@ -1,40 +0,0 @@ -package state - -// Code generated by weld. DO NOT EDIT. - -import ( - "example/sort_with_bind" - "example/sort_with_bind/providers" -) - -func MakeBackends() (Backends, error) { - var ( - b backendsImpl - ) - - b.foo = providers.NewFoo() - - b.bar = providers.NewBar(b.foo) - - b.baz = providers.NewBaz(b.bar) - - return &b, nil -} - -type backendsImpl struct { - foo sort_with_bind.Foo - bar sort_with_bind.Bar - baz sort_with_bind.Baz -} - -func (b *backendsImpl) GetFoo() sort_with_bind.Foo { - return b.foo -} - -func (b *backendsImpl) GetBar() sort_with_bind.Bar { - return b.bar -} - -func (b *backendsImpl) GetBaz() sort_with_bind.Baz { - return b.baz -} diff --git a/internal/testdata/example/transitive/state/backends_gen.go b/internal/testdata/example/transitive/state/backends_gen.go deleted file mode 100644 index 138b4aa..0000000 --- a/internal/testdata/example/transitive/state/backends_gen.go +++ /dev/null @@ -1,14 +0,0 @@ -package state - -// Code generated by weld. DO NOT EDIT. - -import ( - transitive_ops "example/transitive/ops" -) - -type Backends interface { - Foo() transitive_ops.Foo - Qux() transitive_ops.Qux - Bar() transitive_ops.Bar - Baz() transitive_ops.Baz -} diff --git a/internal/testdata/example/transitive/state/testing_gen.go b/internal/testdata/example/transitive/state/testing_gen.go deleted file mode 100644 index 93aedcd..0000000 --- a/internal/testdata/example/transitive/state/testing_gen.go +++ /dev/null @@ -1,93 +0,0 @@ -//go:build !dev - -package state - -// Code generated by weld. DO NOT EDIT. - -import ( - transitive_ops "example/transitive/ops" - "testing" -) - -func NewTestingBackends(b Backends) *TestingBackends { - return &TestingBackends{ - Backends: b, - } -} - -type TestingBackends struct { - Backends - - foo transitive_ops.Foo - qux transitive_ops.Qux - bar transitive_ops.Bar - baz transitive_ops.Baz -} - -func (ti *TestingBackends) Foo() transitive_ops.Foo { - if ti.foo != nil { - return ti.foo - } - - return ti.Backends.Foo() -} - -func (ti *TestingBackends) Qux() transitive_ops.Qux { - if ti.qux != nil { - return ti.qux - } - - return ti.Backends.Qux() -} - -func (ti *TestingBackends) Bar() transitive_ops.Bar { - if ti.bar != nil { - return ti.bar - } - - return ti.Backends.Bar() -} - -func (ti *TestingBackends) Baz() transitive_ops.Baz { - if ti.baz != nil { - return ti.baz - } - - return ti.Backends.Baz() -} - -// SetFooForTesting is a runtime available override for the "foo" dependency that should only be used for testing. -func (ti *TestingBackends) SetFooForTesting(t *testing.T, foo transitive_ops.Foo) { - t.Cleanup(func() { - ti.foo = nil - }) - - ti.foo = foo -} - -// SetQuxForTesting is a runtime available override for the "qux" dependency that should only be used for testing. -func (ti *TestingBackends) SetQuxForTesting(t *testing.T, qux transitive_ops.Qux) { - t.Cleanup(func() { - ti.qux = nil - }) - - ti.qux = qux -} - -// SetBarForTesting is a runtime available override for the "bar" dependency that should only be used for testing. -func (ti *TestingBackends) SetBarForTesting(t *testing.T, bar transitive_ops.Bar) { - t.Cleanup(func() { - ti.bar = nil - }) - - ti.bar = bar -} - -// SetBazForTesting is a runtime available override for the "baz" dependency that should only be used for testing. -func (ti *TestingBackends) SetBazForTesting(t *testing.T, baz transitive_ops.Baz) { - t.Cleanup(func() { - ti.baz = nil - }) - - ti.baz = baz -} diff --git a/internal/testdata/example/transitive/state/weld_gen.go b/internal/testdata/example/transitive/state/weld_gen.go deleted file mode 100644 index 93438c5..0000000 --- a/internal/testdata/example/transitive/state/weld_gen.go +++ /dev/null @@ -1,57 +0,0 @@ -//go:build !dev - -package state - -// Code generated by weld. DO NOT EDIT. - -import ( - transitive_ops "example/transitive/ops" - - "github.com/luno/jettison/errors" -) - -func MakeBackends() (Backends, error) { - var ( - b backendsImpl - err error - ) - - b.foo, err = transitive_ops.NewFoo() - if err != nil { - return nil, errors.Wrap(err, "transitive ops new foo") - } - - b.qux, err = transitive_ops.NewQux() - if err != nil { - return nil, errors.Wrap(err, "transitive ops new qux") - } - - b.bar = transitive_ops.NewBar(b.foo) - - b.baz = transitive_ops.NewBaz(b.bar, b.qux) - - return &b, nil -} - -type backendsImpl struct { - foo transitive_ops.Foo - qux transitive_ops.Qux - bar transitive_ops.Bar - baz transitive_ops.Baz -} - -func (b *backendsImpl) Foo() transitive_ops.Foo { - return b.foo -} - -func (b *backendsImpl) Qux() transitive_ops.Qux { - return b.qux -} - -func (b *backendsImpl) Bar() transitive_ops.Bar { - return b.bar -} - -func (b *backendsImpl) Baz() transitive_ops.Baz { - return b.baz -} diff --git a/internal/testdata/example/variadic/state/backends_gen.go b/internal/testdata/example/variadic/state/backends_gen.go deleted file mode 100644 index dc6a701..0000000 --- a/internal/testdata/example/variadic/state/backends_gen.go +++ /dev/null @@ -1,11 +0,0 @@ -package state - -// Code generated by weld. DO NOT EDIT. - -import ( - variadic_ops "example/variadic/ops" -) - -type Backends interface { - Foo() variadic_ops.Foo -} diff --git a/internal/testdata/example/variadic/state/weld_gen.go b/internal/testdata/example/variadic/state/weld_gen.go deleted file mode 100644 index ce1bf91..0000000 --- a/internal/testdata/example/variadic/state/weld_gen.go +++ /dev/null @@ -1,32 +0,0 @@ -package state - -// Code generated by weld. DO NOT EDIT. - -import ( - variadic_ops "example/variadic/ops" - "testing" - - "github.com/luno/jettison/errors" -) - -func MakeBackends(t *testing.T) (Backends, error) { - var ( - b backendsImpl - err error - ) - - b.foo, err = variadic_ops.NewFooForTesting(t) - if err != nil { - return nil, errors.Wrap(err, "variadic ops new foo for testing") - } - - return &b, nil -} - -type backendsImpl struct { - foo variadic_ops.Foo -} - -func (b *backendsImpl) Foo() variadic_ops.Foo { - return b.foo -} diff --git a/internal/testdata/exchange_tpldata.golden b/internal/testdata/exchange_tpldata.golden index 0bca440..1767630 100644 --- a/internal/testdata/exchange_tpldata.golden +++ b/internal/testdata/exchange_tpldata.golden @@ -3,92 +3,92 @@ tags: '!dev' backendstype: exchange_ops.Backends backendsname: Backends imports: - example/exchange: - name: exchange - pkgpath: example/exchange - aliased: false - example/exchange/db: - name: exchange_db - pkgpath: example/exchange/db - aliased: true - example/exchange/ops: - name: exchange_ops - pkgpath: example/exchange/ops - aliased: true - example/external/versioned: - name: versioned - pkgpath: example/external/versioned - aliased: false - example/external/versioned/v1: - name: versioned_v1 - pkgpath: example/external/versioned/v1 - aliased: true - example/identity/email: - name: email - pkgpath: example/identity/email - aliased: false - example/identity/email/client/grpc: - name: email_client_grpc - pkgpath: example/identity/email/client/grpc - aliased: true - example/identity/users: - name: users - pkgpath: example/identity/users - aliased: false - example/identity/users/client/grpc: - name: users_client_grpc - pkgpath: example/identity/users/client/grpc - aliased: true + example/exchange: + name: exchange + pkgpath: example/exchange + aliased: false + example/exchange/db: + name: exchange_db + pkgpath: example/exchange/db + aliased: true + example/exchange/ops: + name: exchange_ops + pkgpath: example/exchange/ops + aliased: true + example/external/versioned: + name: versioned + pkgpath: example/external/versioned + aliased: false + example/external/versioned/v1: + name: versioned_v1 + pkgpath: example/external/versioned/v1 + aliased: true + example/identity/email: + name: email + pkgpath: example/identity/email + aliased: false + example/identity/email/client/grpc: + name: email_client_grpc + pkgpath: example/identity/email/client/grpc + aliased: true + example/identity/users: + name: users + pkgpath: example/identity/users + aliased: false + example/identity/users/client/grpc: + name: users_client_grpc + pkgpath: example/identity/users/client/grpc + aliased: true params: [] deps: -- type: email.Client - var: email - getter: Email - isduplicate: false - provider: - funcpkg: email_client_grpc - funcname: New - returnserr: true - params: [] - errwrapmsg: email client grpc new -- type: '*exchange_db.ExchangeDB' - var: exchangeDB - getter: ExchangeDB - isduplicate: false - provider: - funcpkg: exchange_db - funcname: Connect - returnserr: true - params: [] - errwrapmsg: exchange db connect -- type: chan<- exchange.Model - var: modelChan - getter: ModelChan - isduplicate: false - provider: - funcpkg: "" - funcname: NewModelChan - returnserr: false - params: [] - errwrapmsg: exchange state new model chan -- type: users.Client - var: users - getter: Users - isduplicate: false - provider: - funcpkg: users_client_grpc - funcname: New - returnserr: true - params: [] - errwrapmsg: users client grpc new -- type: '*versioned_v1.Service' - var: versioned - getter: Versioned - isduplicate: false - provider: - funcpkg: versioned - funcname: New - returnserr: false - params: [] - errwrapmsg: versioned new + - type: email.Client + var: email + getter: Email + isduplicate: false + provider: + funcpkg: email_client_grpc + funcname: New + returnserr: true + params: [] + errwrapmsg: email client grpc new + - type: '*exchange_db.ExchangeDB' + var: exchangeDB + getter: ExchangeDB + isduplicate: false + provider: + funcpkg: exchange_db + funcname: Connect + returnserr: true + params: [] + errwrapmsg: exchange db connect + - type: chan<- exchange.Model + var: modelChan + getter: ModelChan + isduplicate: false + provider: + funcpkg: "" + funcname: NewModelChan + returnserr: false + params: [] + errwrapmsg: exchange state new model chan + - type: users.Client + var: users + getter: Users + isduplicate: false + provider: + funcpkg: users_client_grpc + funcname: New + returnserr: true + params: [] + errwrapmsg: users client grpc new + - type: '*versioned_v1.Service' + var: versioned + getter: Versioned + isduplicate: false + provider: + funcpkg: versioned + funcname: New + returnserr: false + params: [] + errwrapmsg: versioned new transbcks: [] diff --git a/internal/testdata/identity_tpldata.golden b/internal/testdata/identity_tpldata.golden index 128d6e1..b3b673e 100644 --- a/internal/testdata/identity_tpldata.golden +++ b/internal/testdata/identity_tpldata.golden @@ -3,120 +3,120 @@ tags: '!dev' backendstype: Backends backendsname: Backends imports: - example/exchange: - name: exchange - pkgpath: example/exchange - aliased: false - example/exchange/client/grpc: - name: exchange_client_grpc - pkgpath: example/exchange/client/grpc - aliased: true - example/external/mail: - name: mail - pkgpath: example/external/mail - aliased: false - example/external/mail/mail: - name: mail_mail - pkgpath: example/external/mail/mail - aliased: true - example/identity/email: - name: email - pkgpath: example/identity/email - aliased: false - example/identity/email/client/logical: - name: email_client_logical - pkgpath: example/identity/email/client/logical - aliased: true - example/identity/email/db: - name: email_db - pkgpath: example/identity/email/db - aliased: true - example/identity/users: - name: users - pkgpath: example/identity/users - aliased: false - example/identity/users/client/logical: - name: users_client_logical - pkgpath: example/identity/users/client/logical - aliased: true - example/identity/users/db: - name: users_db - pkgpath: example/identity/users/db - aliased: true + example/exchange: + name: exchange + pkgpath: example/exchange + aliased: false + example/exchange/client/grpc: + name: exchange_client_grpc + pkgpath: example/exchange/client/grpc + aliased: true + example/external/mail: + name: mail + pkgpath: example/external/mail + aliased: false + example/external/mail/mail: + name: mail_mail + pkgpath: example/external/mail/mail + aliased: true + example/identity/email: + name: email + pkgpath: example/identity/email + aliased: false + example/identity/email/client/logical: + name: email_client_logical + pkgpath: example/identity/email/client/logical + aliased: true + example/identity/email/db: + name: email_db + pkgpath: example/identity/email/db + aliased: true + example/identity/users: + name: users + pkgpath: example/identity/users + aliased: false + example/identity/users/client/logical: + name: users_client_logical + pkgpath: example/identity/users/client/logical + aliased: true + example/identity/users/db: + name: users_db + pkgpath: example/identity/users/db + aliased: true params: [] deps: -- type: email.Client - var: email - getter: Email - isduplicate: false - provider: - funcpkg: email_client_logical - funcname: New - returnserr: false - params: - - '&b' - errwrapmsg: email client logical new -- type: '*email_db.EmailDB' - var: emailDB - getter: EmailDB - isduplicate: false - provider: - funcpkg: email_db - funcname: Connect - returnserr: true - params: [] - errwrapmsg: email db connect -- type: exchange.Client - var: exchange - getter: Exchange - isduplicate: false - provider: - funcpkg: exchange_client_grpc - funcname: New - returnserr: true - params: [] - errwrapmsg: exchange client grpc new -- type: '*mail.Mailer' - var: mailer - getter: Mailer - isduplicate: false - provider: - funcpkg: mail - funcname: New - returnserr: true - params: [] - errwrapmsg: mail new -- type: '*mail_mail.MailerLegacy' - var: mailerLegacy - getter: MailerLegacy - isduplicate: false - provider: - funcpkg: mail_mail - funcname: New - returnserr: true - params: [] - errwrapmsg: mail new -- type: users.Client - var: users - getter: Users - isduplicate: false - provider: - funcpkg: users_client_logical - funcname: New - returnserr: false - params: - - '&b' - errwrapmsg: users client logical new -- type: '*users_db.UsersDB' - var: usersDB - getter: UsersDB - isduplicate: false - provider: - funcpkg: users_db - funcname: Connect - returnserr: true - params: [] - errwrapmsg: users db connect + - type: email.Client + var: email + getter: Email + isduplicate: false + provider: + funcpkg: email_client_logical + funcname: New + returnserr: false + params: + - '&b' + errwrapmsg: email client logical new + - type: '*email_db.EmailDB' + var: emailDB + getter: EmailDB + isduplicate: false + provider: + funcpkg: email_db + funcname: Connect + returnserr: true + params: [] + errwrapmsg: email db connect + - type: exchange.Client + var: exchange + getter: Exchange + isduplicate: false + provider: + funcpkg: exchange_client_grpc + funcname: New + returnserr: true + params: [] + errwrapmsg: exchange client grpc new + - type: '*mail.Mailer' + var: mailer + getter: Mailer + isduplicate: false + provider: + funcpkg: mail + funcname: New + returnserr: true + params: [] + errwrapmsg: mail new + - type: '*mail_mail.MailerLegacy' + var: mailerLegacy + getter: MailerLegacy + isduplicate: false + provider: + funcpkg: mail_mail + funcname: New + returnserr: true + params: [] + errwrapmsg: mail new + - type: users.Client + var: users + getter: Users + isduplicate: false + provider: + funcpkg: users_client_logical + funcname: New + returnserr: false + params: + - '&b' + errwrapmsg: users client logical new + - type: '*users_db.UsersDB' + var: usersDB + getter: UsersDB + isduplicate: false + provider: + funcpkg: users_db + funcname: Connect + returnserr: true + params: [] + errwrapmsg: users db connect transbcks: -- email_client_logical.Backends -- users_client_logical.Backends + - email_client_logical.Backends + - users_client_logical.Backends diff --git a/internal/testdata/no_err_tpldata.golden b/internal/testdata/no_err_tpldata.golden index d44229c..2422a4e 100644 --- a/internal/testdata/no_err_tpldata.golden +++ b/internal/testdata/no_err_tpldata.golden @@ -5,14 +5,14 @@ backendsname: Backends imports: {} params: [] deps: -- type: bool - var: foo - getter: Foo - isduplicate: false - provider: - funcpkg: "" - funcname: foo - returnserr: false - params: [] - errwrapmsg: no_err state foo + - type: bool + var: foo + getter: Foo + isduplicate: false + provider: + funcpkg: "" + funcname: foo + returnserr: false + params: [] + errwrapmsg: no_err state foo transbcks: [] diff --git a/internal/testdata/parameters_tpldata.golden b/internal/testdata/parameters_tpldata.golden index 5ad530b..a7080f7 100644 --- a/internal/testdata/parameters_tpldata.golden +++ b/internal/testdata/parameters_tpldata.golden @@ -3,36 +3,36 @@ tags: "" backendstype: Backends backendsname: Backends imports: - context: - name: context - pkgpath: context - aliased: false + context: + name: context + pkgpath: context + aliased: false params: -- name: context - type: context.Context -- name: bar - type: Bar + - name: context + type: context.Context + - name: bar + type: Bar deps: -- type: Fizz - var: fizz - getter: GetFizz - isduplicate: false - provider: - funcpkg: "" - funcname: MakeFizz - returnserr: true - params: - - context - errwrapmsg: param state make fizz -- type: Foo - var: foo - getter: GetFoo - isduplicate: false - provider: - funcpkg: "" - funcname: MakeFoo - returnserr: false - params: - - bar - errwrapmsg: param state make foo + - type: Fizz + var: fizz + getter: GetFizz + isduplicate: false + provider: + funcpkg: "" + funcname: MakeFizz + returnserr: true + params: + - context + errwrapmsg: param state make fizz + - type: Foo + var: foo + getter: GetFoo + isduplicate: false + provider: + funcpkg: "" + funcname: MakeFoo + returnserr: false + params: + - bar + errwrapmsg: param state make foo transbcks: [] diff --git a/internal/testdata/samevar_tpldata.golden b/internal/testdata/samevar_tpldata.golden index 0a3974c..4f76e5c 100644 --- a/internal/testdata/samevar_tpldata.golden +++ b/internal/testdata/samevar_tpldata.golden @@ -3,30 +3,30 @@ tags: "" backendstype: Backends backendsname: Backends imports: - example/samevar/pool: - name: pool - pkgpath: example/samevar/pool - aliased: false + example/samevar/pool: + name: pool + pkgpath: example/samevar/pool + aliased: false params: [] deps: -- type: '*pool.BarPool' - var: pool - getter: GetPool - isduplicate: false - provider: - funcpkg: pool - funcname: NewBarPool - returnserr: false - params: [] - errwrapmsg: pool new bar pool -- type: '*pool.FooPool' - var: pool1 - getter: Pool - isduplicate: false - provider: - funcpkg: pool - funcname: NewFooPool - returnserr: false - params: [] - errwrapmsg: pool new foo pool + - type: '*pool.BarPool' + var: pool + getter: GetPool + isduplicate: false + provider: + funcpkg: pool + funcname: NewBarPool + returnserr: false + params: [] + errwrapmsg: pool new bar pool + - type: '*pool.FooPool' + var: pool1 + getter: Pool + isduplicate: false + provider: + funcpkg: pool + funcname: NewFooPool + returnserr: false + params: [] + errwrapmsg: pool new foo pool transbcks: [] diff --git a/internal/testdata/sort_with_bind_tpldata.golden b/internal/testdata/sort_with_bind_tpldata.golden index 5a3eb07..a73d5b0 100644 --- a/internal/testdata/sort_with_bind_tpldata.golden +++ b/internal/testdata/sort_with_bind_tpldata.golden @@ -3,46 +3,46 @@ tags: "" backendstype: Backends backendsname: Backends imports: - example/sort_with_bind: - name: sort_with_bind - pkgpath: example/sort_with_bind - aliased: false - example/sort_with_bind/providers: - name: providers - pkgpath: example/sort_with_bind/providers - aliased: false + example/sort_with_bind: + name: sort_with_bind + pkgpath: example/sort_with_bind + aliased: false + example/sort_with_bind/providers: + name: providers + pkgpath: example/sort_with_bind/providers + aliased: false params: [] deps: -- type: sort_with_bind.Foo - var: foo - getter: GetFoo - isduplicate: false - provider: - funcpkg: providers - funcname: NewFoo - returnserr: false - params: [] - errwrapmsg: providers new foo -- type: sort_with_bind.Bar - var: bar - getter: GetBar - isduplicate: false - provider: - funcpkg: providers - funcname: NewBar - returnserr: false - params: - - b.foo - errwrapmsg: providers new bar -- type: sort_with_bind.Baz - var: baz - getter: GetBaz - isduplicate: false - provider: - funcpkg: providers - funcname: NewBaz - returnserr: false - params: - - b.bar - errwrapmsg: providers new baz + - type: sort_with_bind.Foo + var: foo + getter: GetFoo + isduplicate: false + provider: + funcpkg: providers + funcname: NewFoo + returnserr: false + params: [] + errwrapmsg: providers new foo + - type: sort_with_bind.Bar + var: bar + getter: GetBar + isduplicate: false + provider: + funcpkg: providers + funcname: NewBar + returnserr: false + params: + - b.foo + errwrapmsg: providers new bar + - type: sort_with_bind.Baz + var: baz + getter: GetBaz + isduplicate: false + provider: + funcpkg: providers + funcname: NewBaz + returnserr: false + params: + - b.bar + errwrapmsg: providers new baz transbcks: [] diff --git a/internal/testdata/testing_tpldata.golden b/internal/testdata/testing_tpldata.golden index 35ce060..222a4f8 100644 --- a/internal/testdata/testing_tpldata.golden +++ b/internal/testdata/testing_tpldata.golden @@ -5,14 +5,14 @@ backendsname: Backends imports: {} params: [] deps: -- type: Foo - var: foo - getter: Foo - isduplicate: false - provider: - funcpkg: "" - funcname: MakeFoo - returnserr: false - params: [] - errwrapmsg: testing state make foo + - type: Foo + var: foo + getter: Foo + isduplicate: false + provider: + funcpkg: "" + funcname: MakeFoo + returnserr: false + params: [] + errwrapmsg: testing state make foo transbcks: [] diff --git a/internal/testdata/transitive-testing_tpldata.golden b/internal/testdata/transitive-testing_tpldata.golden index 3c07348..6d0b317 100644 --- a/internal/testdata/transitive-testing_tpldata.golden +++ b/internal/testdata/transitive-testing_tpldata.golden @@ -3,53 +3,53 @@ tags: '!dev' backendstype: Backends backendsname: Backends imports: - example/transitive/ops: - name: transitive_ops - pkgpath: example/transitive/ops - aliased: true + example/transitive/ops: + name: transitive_ops + pkgpath: example/transitive/ops + aliased: true params: [] deps: -- type: transitive_ops.Foo - var: foo - getter: Foo - isduplicate: false - provider: - funcpkg: transitive_ops - funcname: NewFoo - returnserr: true - params: [] - errwrapmsg: transitive ops new foo -- type: transitive_ops.Qux - var: qux - getter: Qux - isduplicate: false - provider: - funcpkg: transitive_ops - funcname: NewQux - returnserr: true - params: [] - errwrapmsg: transitive ops new qux -- type: transitive_ops.Bar - var: bar - getter: Bar - isduplicate: false - provider: - funcpkg: transitive_ops - funcname: NewBar - returnserr: false - params: - - b.foo - errwrapmsg: transitive ops new bar -- type: transitive_ops.Baz - var: baz - getter: Baz - isduplicate: false - provider: - funcpkg: transitive_ops - funcname: NewBaz - returnserr: false - params: - - b.bar - - b.qux - errwrapmsg: transitive ops new baz + - type: transitive_ops.Foo + var: foo + getter: Foo + isduplicate: false + provider: + funcpkg: transitive_ops + funcname: NewFoo + returnserr: true + params: [] + errwrapmsg: transitive ops new foo + - type: transitive_ops.Qux + var: qux + getter: Qux + isduplicate: false + provider: + funcpkg: transitive_ops + funcname: NewQux + returnserr: true + params: [] + errwrapmsg: transitive ops new qux + - type: transitive_ops.Bar + var: bar + getter: Bar + isduplicate: false + provider: + funcpkg: transitive_ops + funcname: NewBar + returnserr: false + params: + - b.foo + errwrapmsg: transitive ops new bar + - type: transitive_ops.Baz + var: baz + getter: Baz + isduplicate: false + provider: + funcpkg: transitive_ops + funcname: NewBaz + returnserr: false + params: + - b.bar + - b.qux + errwrapmsg: transitive ops new baz transbcks: [] diff --git a/internal/testdata/transitive_tpldata.golden b/internal/testdata/transitive_tpldata.golden index 3c07348..6d0b317 100644 --- a/internal/testdata/transitive_tpldata.golden +++ b/internal/testdata/transitive_tpldata.golden @@ -3,53 +3,53 @@ tags: '!dev' backendstype: Backends backendsname: Backends imports: - example/transitive/ops: - name: transitive_ops - pkgpath: example/transitive/ops - aliased: true + example/transitive/ops: + name: transitive_ops + pkgpath: example/transitive/ops + aliased: true params: [] deps: -- type: transitive_ops.Foo - var: foo - getter: Foo - isduplicate: false - provider: - funcpkg: transitive_ops - funcname: NewFoo - returnserr: true - params: [] - errwrapmsg: transitive ops new foo -- type: transitive_ops.Qux - var: qux - getter: Qux - isduplicate: false - provider: - funcpkg: transitive_ops - funcname: NewQux - returnserr: true - params: [] - errwrapmsg: transitive ops new qux -- type: transitive_ops.Bar - var: bar - getter: Bar - isduplicate: false - provider: - funcpkg: transitive_ops - funcname: NewBar - returnserr: false - params: - - b.foo - errwrapmsg: transitive ops new bar -- type: transitive_ops.Baz - var: baz - getter: Baz - isduplicate: false - provider: - funcpkg: transitive_ops - funcname: NewBaz - returnserr: false - params: - - b.bar - - b.qux - errwrapmsg: transitive ops new baz + - type: transitive_ops.Foo + var: foo + getter: Foo + isduplicate: false + provider: + funcpkg: transitive_ops + funcname: NewFoo + returnserr: true + params: [] + errwrapmsg: transitive ops new foo + - type: transitive_ops.Qux + var: qux + getter: Qux + isduplicate: false + provider: + funcpkg: transitive_ops + funcname: NewQux + returnserr: true + params: [] + errwrapmsg: transitive ops new qux + - type: transitive_ops.Bar + var: bar + getter: Bar + isduplicate: false + provider: + funcpkg: transitive_ops + funcname: NewBar + returnserr: false + params: + - b.foo + errwrapmsg: transitive ops new bar + - type: transitive_ops.Baz + var: baz + getter: Baz + isduplicate: false + provider: + funcpkg: transitive_ops + funcname: NewBaz + returnserr: false + params: + - b.bar + - b.qux + errwrapmsg: transitive ops new baz transbcks: [] diff --git a/internal/testdata/variadic_tpldata.golden b/internal/testdata/variadic_tpldata.golden index 457f137..87c975c 100644 --- a/internal/testdata/variadic_tpldata.golden +++ b/internal/testdata/variadic_tpldata.golden @@ -3,27 +3,27 @@ tags: "" backendstype: Backends backendsname: Backends imports: - example/variadic/ops: - name: variadic_ops - pkgpath: example/variadic/ops - aliased: true - testing: - name: testing - pkgpath: testing - aliased: false + example/variadic/ops: + name: variadic_ops + pkgpath: example/variadic/ops + aliased: true + testing: + name: testing + pkgpath: testing + aliased: false params: -- name: t - type: '*testing.T' + - name: t + type: '*testing.T' deps: -- type: variadic_ops.Foo - var: foo - getter: Foo - isduplicate: false - provider: - funcpkg: variadic_ops - funcname: NewFooForTesting - returnserr: true - params: - - t - errwrapmsg: variadic ops new foo for testing + - type: variadic_ops.Foo + var: foo + getter: Foo + isduplicate: false + provider: + funcpkg: variadic_ops + funcname: NewFooForTesting + returnserr: true + params: + - t + errwrapmsg: variadic ops new foo for testing transbcks: []