Closed KantarBruceAdams closed 5 years ago
I'm working on this issue. It should be done by tomorrow.
Hi @KantarBruceAdams While implementing the feature, I realized that it's rather confusing for the user to process multiple files as gocontracts outputs the code to stdout by default. Processing multiple files would add a confusing constraint to the command-line arguments that you have to process files in-place if you specify multiple.
If you are using linux, you can always call:
``bash find . -name "*.go" -exec gocontracts -w {} \;
Since `go fmt` follows the same convention, I finally decided to stick with it.
Once we add invariants, I'll add support for recursive iteration over packages. (I plan to work on invariants in Jan-Mar 2019).
rather than output to stdout it would make more sense to require an output directory.
E.g. four usages:
gocontracts
Of course you can use bash for anything that does a single file at a time but I was thinking to internalize the boilerplate
@KantarBruceAdams, I had another look at the code, but there is no easy way to keep the inferface simple. I suppose that's also reflected in the design of gofmt.
I'll start to implement invariants in March 2019 which will require gocontracts to operate on packages, and I'll add recursion there.
The tool currently supports only processing one file at a time. For example:
This would make it less convenient to use in production.