Skip to content
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

Feature request: Use version instead of timestamp when generate go structs #26

Closed
chnhaoran opened this issue May 11, 2023 · 5 comments
Closed

Comments

@chnhaoran
Copy link

A comment like "// Root was generated 2019-06-11 16:27:04 by tir on hayiti." is added to the code when generate go structs from xml. However, in a batch-like operation (iterate xml files in a directory), even 1 xml file changes, we will see update in every file, which is not friendly to a git commit. Compared to timestamp, sometimes version is more useful as features are always binded to a specific version. It will be nice if a feature switch is provided to let users choose which comments they prefer.

@miku
Copy link
Owner

miku commented May 22, 2023

One solution you can use directly is to use the -B flag:

-B    use a fixed banner string (e.g. for CI)

We added that not too long ago exactly because we needed reproducibility (e.g. in CI). Does that work for you?

@chnhaoran
Copy link
Author

One solution you can use directly is to use the -B flag:

-B    use a fixed banner string (e.g. for CI)

We added that not too long ago exactly because we needed reproducibility (e.g. in CI). Does that work for you?

Seems great!

Still recommend add a version if possible in later releases. An example is what protoc does

// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// 	protoc-gen-go v1.28.1
// 	protoc        v3.20.3

-B works for me now. Thanks!

@chnhaoran
Copy link
Author

@miku Do you mind me submitting a PR to add version in the banner?

@miku
Copy link
Owner

miku commented Feb 19, 2024

Since v0.1.23 comments will contain the version of the tool that generated the struct. Thanks for highlighting the issue.

@chnhaoran
Copy link
Author

Since v0.1.23 comments will contain the version of the tool that generated the struct. Thanks for highlighting the issue.

Good to know, thanks!

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

No branches or pull requests

2 participants