-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Identify generated files #40
Comments
To my knowledge, only protobuf uses this behaviour. Most generated files of the Go standard library still uses a That being said, I can't say I would be against in proposal as such. List (loong list) of Go source files from the standard library containing the word "generated": Only one Go file has two extensions, namely
|
Hmmm very very interesting. |
It would be nice not to have to write this code though
|
How about introducing |
That sounds really good, but extensions are useful for other things as well. |
So I am on the fence now. Maybe someone else can make a compelling argument either way. |
Makes sense. Also, this would make it easier to ignore Gocc generated files from golint, at least until issues such as #36 are resolved. So, if you which to use this now in one of your projects, you have a +1 from me. As long as its not just an imagined feature, but one that you would use today. I think I might use it in the future, and extensions make it more flexible. |
I think I should add the |
Is there a way in go to remove directories only if empty?
|
Sorry for the noise.
os.Remove will do it fine I guess, returning an error if directory not
empty I understood it as.
|
@sangisos So we could just remove the folders containing the generated code, but I typically add more code to the parser folder at least. And I sometimes like to add a doc.go to the other folders. |
@awalterschulze Yes, sorry if I was unclear. You first remove all induvidual generated
files, then you try to remove the directories. As I understand the
os.Remove command, it will only remove a directory if it is empty, so it
should be safe to use even when you have your own files inside the
directories. It will then not remove the directory leaving your non-generated files in the directory.
|
Related, golang/go#13560 |
We have already updated the code generator to add the suggested comment to
the files. But we have not implemented any tooling like gocc clean yet.
Does anyone know whether go is thinking of creating a `go generate clean`
command, so that we don't have to do double work here?
…On Fri, 29 Dec 2017, 07:30 Damian Gryski, ***@***.***> wrote:
Related, golang/go#13560 <golang/go#13560>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#40 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABvsLZR5x_KRzKedGA1zUwDn7lcyzoT3ks5tFIbtgaJpZM4LKz4j>
.
|
We have added a comment above in each file saying that it is generated and that helps alot.
It would be even better if we could add a file extension.
protobuf has .pb.go
Maybe we could have .gocc.go
This will also help when wanting to clean up after gocc, because its easier to identify the generated files this way.
The text was updated successfully, but these errors were encountered: