Building a Wails application fails with -buildvcs=false recommendation

Originally posted on 2024-05-08

Sometimes when you build a Wails application you’ll get this error:

error obtaining VCS status: exit status 128
Use -buildvcs=false to disable VCS stamping.

To disable this on a single build (with a bash-like shell) you can do this:

GOFLAGS="-buildvcs=false" wails dev

Or:

GOFLAGS="-buildvcs=false" wails build

To set that flag once so you don’t have to do this every time you can do this:

go env -w GOFLAGS="-buildvcs=false"

And later if you want to undo it you can just do this:

go env -u GOFLAGS