Skip to content

Commit

Permalink
gomod: Update to 1.23, add types.Alias case
Browse files Browse the repository at this point in the history
  • Loading branch information
echarrod committed Oct 28, 2024
1 parent 4a41c43 commit 6614757
Show file tree
Hide file tree
Showing 27 changed files with 398 additions and 18 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/luno/weld

go 1.22
go 1.23.2

require (
github.com/luno/jettison v0.0.0-20240722160230-b42bd507a5f6
Expand Down
13 changes: 12 additions & 1 deletion internal/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,13 @@ func makeTplBcks(pkgCache *PkgCache, bcks []Backends) ([]string, error) {
}

// makeTplDep returns the template dependency and template imports of the dependency.
func makeTplDep(pkgCache *PkgCache, nodes []Node, getter string, dep types.Type, varMap map[string]string) (*TplDep, error) {
func makeTplDep(
pkgCache *PkgCache,
nodes []Node,
getter string,
dep types.Type,
varMap map[string]string,
) (*TplDep, error) {
for _, node := range nodes {
if node.Type == NodeTypeBind {
if !types.Identical(node.BindInterface, dep) {
Expand Down Expand Up @@ -567,6 +573,11 @@ func getTypePkgs(tl ...types.Type) ([]*types.Package, error) {
tl := tupleTypes(t.Params())
tl = append(tl, tupleTypes(t.Results())...)
pl, err = getTypePkgs(tl...)
case *types.Alias:
pkg := t.Obj().Pkg()
if pkg != nil {
pl = []*types.Package{pkg}
}
default:
return nil, errors.New("cannot detect import for type", j.MKV{"type": t})
}
Expand Down
2 changes: 1 addition & 1 deletion internal/testdata/dev_exchange_graph.golden
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Set[11]: (inline)
Func[1]: func example/external/mail.New(opts ...example/external/mail.option) (*example/external/mail.Mailer, error)
Func[1]: func example/external/mail/mail.New() (*example/external/mail/mail.MailerLegacy, error)
Func[1]: func example/external/versioned.New() *example/external/versioned/v1.Service
Func[1]: func example/exchange/state.NewGenericStringType() example/exchange/ops.TestFunc[example/exchange.Model, string]
Func[1]: func example/exchange/state.NewGenericStringType() example/exchange/ops.GenericStringType
2 changes: 1 addition & 1 deletion internal/testdata/dev_exchange_selected.golden
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Func[1]: func example/exchange/db.Connect() (*example/exchange/db.ExchangeDB, error)
Func[1]: func example/external/versioned.New() *example/external/versioned/v1.Service
Func[1]: func example/exchange/state.NewModelChan() chan<- example/exchange.Model
Func[1]: func example/exchange/state.NewGenericStringType() example/exchange/ops.TestFunc[example/exchange.Model, string]
Func[1]: func example/exchange/state.NewGenericStringType() example/exchange/ops.GenericStringType
Func[1]: func example/identity/email/client/dev.Make(b example/identity/email/client/logical.Backends) (example/identity/email.Client, error)
Func[1]: func example/identity/users/client/dev.Make(b example/identity/users/client/logical.Backends) (example/identity/users.Client, error)
Func[1]: func example/identity/email/db.Connect() (*example/identity/email/db.EmailDB, error)
Expand Down
2 changes: 1 addition & 1 deletion internal/testdata/dev_exchange_specBack.golden
Original file line number Diff line number Diff line change
@@ -1 +1 @@
example/exchange/ops.Backends[6]: *example/exchange/db.ExchangeDB, *example/external/versioned/v1.Service, chan<- example/exchange.Model, example/exchange/ops.TestFunc[example/exchange.Model, string], example/identity/email.Client, example/identity/users.Client
example/exchange/ops.Backends[6]: *example/exchange/db.ExchangeDB, *example/external/versioned/v1.Service, chan<- example/exchange.Model, example/exchange/ops.GenericStringType, example/identity/email.Client, example/identity/users.Client
2 changes: 1 addition & 1 deletion internal/testdata/dev_exchange_tpldata.golden
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ deps:
returnserr: true
params: []
errwrapmsg: exchange db connect
- type: exchange_ops.TestFunc[exchange.Model, string]
- type: exchange_ops.GenericStringType
var: genericStringFunc
getter: GenericStringFunc
isduplicate: false
Expand Down
4 changes: 2 additions & 2 deletions internal/testdata/dev_exchange_weldoutput.golden
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ type backendsImpl struct {
email email.Client
emailDB *email_db.EmailDB
exchangeDB *exchange_db.ExchangeDB
genericStringFunc exchange_ops.TestFunc[exchange.Model, string]
genericStringFunc exchange_ops.GenericStringType
modelChan chan<- exchange.Model
users users.Client
usersDB *users_db.UsersDB
Expand All @@ -84,7 +84,7 @@ func (b *backendsImpl) ExchangeDB() *exchange_db.ExchangeDB {
return b.exchangeDB
}

func (b *backendsImpl) GenericStringFunc() exchange_ops.TestFunc[exchange.Model, string] {
func (b *backendsImpl) GenericStringFunc() exchange_ops.GenericStringType {
return b.genericStringFunc
}

Expand Down
8 changes: 8 additions & 0 deletions internal/testdata/example/duplicate/state/backends_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions internal/testdata/example/duplicate/state/weld_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/testdata/example/exchange/state/devstate/weld_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/testdata/example/exchange/state/weld_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions internal/testdata/example/no_err/state/backends_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions internal/testdata/example/no_err/state/weld_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions internal/testdata/example/samevar/state/backends_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions internal/testdata/example/samevar/state/weld_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions internal/testdata/example/sort_with_bind/state/backends_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions internal/testdata/example/sort_with_bind/state/weld_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions internal/testdata/example/transitive/state/backends_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

93 changes: 93 additions & 0 deletions internal/testdata/example/transitive/state/testing_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6614757

Please sign in to comment.