Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Panic on array parsing if length is externally defined #561

Closed
@jmaeso

Description

@jmaeso

Actual behavior

generating code for the following interface makes the tool to panic.

(Note: math constant used just for convenience. Can be any other package-defined constant, not a hardcoded value)

type Fooer interface {
    Foo([math.MaxInt8]string)
}

Output: panic: interface conversion: ast.Expr is *ast.SelectorExpr, not *ast.BasicLit

Expected behavior

Generate a mocked struct with a method that takes a [127]string{} (or [math.MaxInt8]string{}) array

To Reproduce Steps to reproduce the behavior
Explained in the "Actual behaviour" section

Additional Information

  • gomock mode (reflect or source): source
  • gomock version or git ref: v1.5.0
  • golang version: go version go1.15.8 darwin/amd64

Triage Notes for the Maintainers

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions