1

I would like to run a Makefile in IntelliJ whenever a source file changes. Therefore I installed the File Watcher plugin and added a new File Watcher for Go files. In the Watcher Settings I added make as the Program and test for the Arguments.

When I now change a .go file, I get the following error message:

make test
make: *** No rule to make target `test'.  Stop.

Process finished with exit code 2

so I assume that the file watcher works in general but is somehow runs the make command in the wrong directory.

When I run make test in a terminal from the root of my project, everything works as expected and I get:

Formatting all packages...
Code analysis with go vet...
Execute test with ginkgo...
[1490735873] Cmd Suite - 1/1 specs • SUCCESS! 120.183µs PASS
[1490735873] Test Helpers Suite - 4/4 specs •••• SUCCESS! 125.046µs PASS
[1490735873] Models Suite - 5/5 specs ••••• SUCCESS! 453.456µs PASS
[1490735873] Services Suite - 16/16 specs •••••••••••••••• SUCCESS! 3.035275ms PASS

Ginkgo ran 4 suites in 855.886243ms
Test Suite Passed

What am I doing wrong - or am I missing the point of using file watchers in IntelliJ?

Bastien Jansen
  • 8,756
  • 2
  • 35
  • 53
Michael Lihs
  • 7,460
  • 17
  • 52
  • 85

1 Answers1

4

Solution was that I had to specify the Working Directory in Other Options. When I set this to $ContentRoot$, everything works as expected.

enter image description here

Michael Lihs
  • 7,460
  • 17
  • 52
  • 85
  • Good to know, hadn't thought of adding this type of trigger (I only have a `goimports` one configured). – Kaedys Mar 28 '17 at 21:37