1pkg/gopium

[Feature Request] preserve comments

jschaf opened this issue · 0 comments

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:

  • It took me a while to figure out the correct invocation. The mix of positional commands like the walker and package and flag commands was confusing. I think flags alone might be easier to understand:
gopium \
  --package_path=erp/integrate/gsheet \ # package path should probably be relative to $PWD
  --struct_regexp='^InvoiceRow$' \
  --strategies=memory_pack,strategy2
  • I had to use PWD to target the correct directory since gopium prepends src/.