Skip to content

go generate ./... is broken #7976

@williammartin

Description

@williammartin

Description

When adding moq generate stanzas, I expected to be able to run go generate ./... to create my new mocks. Unfortunately, this fails (on trunk):

➜  cli git:(trunk) go generate ./...
couldn't load source package: /Users/williammartin/workspace/cli/internal/config/stub.go:12:24: undefined: ConfigMock (and 2 more errors)
moq [flags] source-dir interface [interface2 [interface3 [...]]]
  -fmt string
        go pretty-printer: gofmt, goimports or noop (default gofmt)
  -out string
        output file (default stdout)
  -pkg string
        package name (default will infer)
  -rm
        first remove output file, if it exists
  -skip-ensure
        suppress mock implementation check, avoid import cycle if mocks generated outside of the tested package
  -stub
        return zero values when no mock implementation is provided, do not panic
  -version
        show the version for moq
  -with-resets
        generate functions to facilitate resetting calls made to a mock
Specifying an alias for the mock is also supported with the format 'interface:alias'
Ex: moq -pkg different . MyInterface:MyMock
internal/config/config.go:20: running "moq": exit status 1

This results in a broken go project.

This isn't explicitly a bug since it doesn't affect the built artifact of the CLI, but it is a really annoying developer experience.

Metadata

Metadata

Assignees

Labels

coreThis issue is not accepting PRs from outside contributorstech-debtA chore that addresses technical debt

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions