1pkg / gopium

Gopium 🌺: Smart Go Structures Optimizer and Manager
MIT License
209 stars 7 forks source link

[Feature Request] preserve comments #33

Open jschaf opened 1 year ago

jschaf commented 1 year ago

First off, super cool library. I use the field alignment govet check, and it's a pain to figure out the optimal struct order manually. With gopium, I was able to get going in ~5 minutes.

I ran the following command:

gopium \
    --walker_regexp='^InvoiceRow' \
    --package_path="$PWD/erp/integrate/gsheet" \
    ast_go erp/integrate/gsheet \
    memory_pack

The struct was successfully reordered to fix the govet field aligment check. However, gopium removed all comments from the struct field. It'd be nice to keep the documentation comments.

Other minor observations. Feel free to ignore. Including since sometimes it's helpful to hear about first-time usage:

gopium \
  --package_path=erp/integrate/gsheet \ # package path should probably be relative to $PWD
  --struct_regexp='^InvoiceRow$' \
  --strategies=memory_pack,strategy2
RB-PRO commented 4 weeks ago

I support the author. Mashing comments to the fields of the structure for me is the very problem that prevents me from using this cool utility for my project. Thanks!