while true; do go test ./foo/bar; fswatch -1 -r . > /dev/null; sleep 0.3; done
It would be nice if go test could do that itself. (The 0.3 second sleep is to let the file-write that triggered the test complete.)
Zellyn
PACKAGES = $$(go list ./... | grep -v /vendor/)
test:
echo 'mode: atomic' > build/coverage.outfor pkg in $(PACKAGES) ; do \
go test -v -covermode=count -coverprofile=build/coverage.tmp $$pkg 2>&1 | tee -a build/test.out; \if [ -e build/coverage.tmp ] ; then tail -n +2 build/coverage.tmp >> build/coverage.out; rm build/coverage.tmp; fi \
donego tool cover -html=build/coverage.out -o build/coverage.html
I run go tests with something like this:while true; do go test ./foo/bar; fswatch -1 -r . > /dev/null; sleep 0.3; done
It would be nice if go test could do that itself. (The 0.3 second sleep is to let the file-write that triggered the test complete.)
-j
On Tue, Oct 18, 2016 at 8:54 PM 'Jaana Burcu Dogan' via golang-nuts <golan...@googlegroups.com> wrote:
The go tool already does a lot of things, perhaps too much of them.
The observation that newcomers have trouble to use it to their advantage is both correct and the evidence of its complexity. Adding new sub-commands has the potential to only make that worse, I'm afraid.
---j
"a possible extension would be to add -watch flag to “go test,” “go install,” and “go run,” which would repeat the command each time a prerequisite file was modified. For example, running “go test -watch” in a terminal window would automatically show compile errors or test output each time a source file was saved."
That's a marvellous hack Aram!
It would still be nicer if there was an easier way though.
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Fri, Nov 4, 2016 at 7:37 AM, <chhato...@gmail.com> wrote:
> Incremental build support in `go build` would be much appreciated.
>
> AIUI, the only way to have incremental builds using standard go tools are
> through `go install`; but `go install` is not a compiler/linker/builder and
> it doesn't simply build a go project.
>
> Even if `go build` doesn't handle incremental builds, if I can use whatever
> the equivalent of `gcc -c example.c -o example.o` and `gcc -o binary
> example.o example2.o ...` are, I'd be happy, since then I could integrate it
> with make. I'm guessing this has been asked before, since it sounds like a
> wish I expect many people would have had, but I couldn't find any
> discussions related to this.
`go build` takes a -o option that you can use to put the results where
you please.
I'm not sure what it means to have `go build` do an incremental build
without using `go install`. Where would the intermediate files go,
and why would we want them in a place different than there `go
install` puts them?
See also `go build -i`.
Ian
go test -v -args -x -v