I have written a small source code processing tool which does something that I personally think that gofmt should do. It's called tidy, and it's hiding inside the embryonic attempt at a 'deal with all those irritating application setup startup stuff' project here:
https://github.com/l0k1verloren/skele/tree/master/cmd/tidy All it does is slice a source file up into the root level sections, package, imports, type, const, var, func. All of the groups are sorted by alphabetical order based on the content of their key line (line starting with root level keyword), the 'main' and 'init' functions are pushed to the top of the block of functions. In theory, it is possible to take an entire package, a whole folder containing all the same package name. It only will pick up one of the package header parts, I'm not sure about imports, I think gofmt automatically consolidates multiple anyway, but yeah it will also stumble over those init blocks too for this. I will probably need to fix that since exactly this merging of sources is one of my intended uses). I don't know why it took me so bleedin long to write it, it was funny, I wrote something that worked about 90% in about an hour and then it took 2 days to redo it, I kept overcomplicating things (ahaha, well, read the prose, know the code :) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.