Skip to content

Generation failure on go 1.23 with type aliases #22

@deefdragon

Description

@deefdragon

When using go toolchain 1.23.0 and go version 1.23, interfaces with methods that has an aliased type as an argument will fail to generate with the following error

[debug] loadPackages took 32.180249ms
[debug] resolvePackagePath took 11.411105ms
Error: generating circuit wrapper: resolvePkgPaths: invalid type: <module>/api.TestAlias

(The file was not in the module root, but in the /api folder, so I would have expected the path to be <module>/api/api.TestAlias)

This is the smallest example I could create, and produced the above error.

package api

import (
	"context"
)

type TestInterface interface {
	SomeFunc(ctx context.Context, body TestAlias) (*int, error)
}

type TestAlias = TestBase

type TestBase struct {
	Foo int
}

Command used to generate:
go run github.com/twitchtv/circuitgen --name TestInterface --pkg ./ --debug --out ./circuit.gen.go --alias TestCircuit --circuit-major-version 3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions