uber-go / mock

GoMock is a mocking framework for the Go programming language.
Apache License 2.0
1.81k stars 103 forks source link

Able to insert copyright file which already has comments into the header #142

Open dmvolod opened 5 months ago

dmvolod commented 5 months ago

Requested feature A clear description of the desired feature and an example of how it would be used.

A way to insert copyright file which already has comments inside into the header

Why the feature is needed A clear description of how this feature is not served by existing functionality in gomock.

In some cases we may install copyright files that already contain comments defined as /*...*/ and we don't want to maintain separate files for separate code generation logic. In this case we need to implement logic to add plain text from the copyright file to the source code without start comment // on each line.

(Optional) Proposed solution A clear description of a proposed method for adding this feature to gomock.

It would be nice to add separate -copyright_file_comments with default(false) value, which will allows to generate different comment lines with or without starting comment line.

r-hang commented 4 months ago

Hey, thanks for filing this issue.

From my understanding of this ask, it's to enable a "raw copy" of content as the header since yours is already commented.

Since we already have an existing flag to add copyright content, I feel that adding a similar flag with very slightly different functionality would cause user confusion because there would now be multiple blessed ways to supply copyright headers to the generated code for a marginal benefit on a particular use case.

dmvolod commented 4 months ago

Thanks for feedback.

Yes, agree, that parameter -copyright_file_comments name a bit confusing and we can use another one, i.e. -copyright_file_raw or some other. But this parameter is very desirable feature, as without it most of the Kubernetes oriented project will requires multiple header files or adds some hacks instead of single predefined option, for example

https://github.com/kubernetes-sigs/cluster-api-addon-provider-helm/blame/21eb53508daed2dc31990ee882f9f0b04ce15b03/internal/mocks/doc.go#L19-L22