matryer / matryer/moq

Error if field type and method have the same name

Open
#170 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.2k
Forks
135
Avg merge
11d 6h
Merged PRs (30d)
1

Description

Hey!

When I do `go generate ./...` I get an error.
```
package main

//go:generate moq -out mocks/some_iface.go . SomeIface

type SomeIface interface {
Begin()
BeginFunc()
}
```

Error:
`Type '*SomeIfaceMock' has both field and method named 'BeginFunc'`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the reported `go generate ./...` example and inspect the generated `mocks/some_iface.go` output for `SomeIfaceMock`. Trace the generator entry point that handles the `Begin` and `BeginFunc` names, then add a regression test showing generation succeeds when a field type and method share a name.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.