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

Generate (some) documentation for generated interface methods #650

Open
jamietanna opened this issue Jun 1, 2022 · 0 comments
Open

Generate (some) documentation for generated interface methods #650

jamietanna opened this issue Jun 1, 2022 · 0 comments

Comments

@jamietanna
Copy link

Requested feature

Generate more appropriate GoDoc for generated interface methods, taking into account the existing docs, if any, and describe the method parameter names.

Why the feature is needed

When generating mocks for a method, for instance database/sql/driver's Conn.Prepare, we get the following GoDoc generated:

// Prepare mocks base method.
func (m *MockConn) Prepare(arg0 string) (driver.Stmt, error) {

This does not make it as easy to understand what arg0, or any other information from the method we're calling, so IDEs can't easily provide hints to the caller what the parameters are/were called.

(Optional) Proposed solution

This would instead generate the following format, or similar:

// Prepare mocks base method.
// Prepare returns a prepared statement, bound to this connection.
// Method signature:
//   (query string) (Stmt, error)
func (m *MockConn) Prepare(arg0 string) (driver.Stmt, error) {

Not sure if the use of the signature there will make sense, so happy to hear suggestions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant