[Bash] List Go Source Files Excluding Test Files
List .go source files, excluding _test.go files via find and grep command in Bash.
$ find *.go | grep -v _test.go
Sometimes we just want to run one of the test files, but need all .go files to run the single test file. We can run as follows in our Makefile.
ALL_GO_SOURCES=$(shell /bin/sh -c "find *.go | grep -v _test.go")
default:
@go test -v $(ALL_GO_SOURCES) oneofmy_test.go
References:
[1] | go - The Go Programming Language |