Skip to content

Commit 4a16463

Browse files
committed
readme: add section on how to keep application running on errors
1 parent 05362d9 commit 4a16463

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ $ wgo run -tags=fts5 -race -trimpath main.go
9494
- [Chaining commands](#chaining-commands)
9595
- [Clear terminal on restart](#clear-terminal-on-restart)
9696
- [Running parallel wgo commands](#running-parallel-wgo-commands)
97+
- [Don't stop the application on compile errors](#dont-stop-the-application-on-compile-errors)
9798
- [Debug Go code using GoLand or VSCode with wgo](#debug-go-code-using-goland-or-vscode-with-wgo)
9899

99100
## Including and excluding files
@@ -388,6 +389,8 @@ $ wgo -postpone echo hello
388389

389390
## Use polling to detect file changes
390391

392+
[*back to flags index*](#flags)
393+
391394
If you wish to poll for file changes instead of using system's builtin file watcher, use the -poll flag. This may sometimes be necessary if the system file watcher is unable to pick up file changes e.g. for files on a mounted network drive.
392395

393396
```shell
@@ -398,6 +401,14 @@ $ wgo run -poll 500ms main.go
398401
$ wgo -poll 1s echo hello
399402
```
400403

404+
## Don't stop the application on compile errors
405+
406+
To keep the old application running even while there are compile errors, separate wgo into two [parallel commands](#running-parallel-wgo-commands): one to compile the application, another to rerun the application whenever the application executable file changes. When there is a syntax error, only the compile step will fail (the run step will keep running). When the compile step succeeds, it will rebuild the executable file which retriggers the run step to rerun the executable.
407+
408+
```shell
409+
$ wgo -file .go go build -o my_app.exe ./my_app :: wgo -postpone -file my_app.exe ./my_app.exe
410+
```
411+
401412
## Debug Go code using GoLand or VSCode with wgo
402413

403414
You need to ensure the [delve debugger](https://github.com/go-delve/delve) is installed.

0 commit comments

Comments
 (0)