%LocalAppData% unset on Windows when using Actions for CI

While testing a Go project on Windows, I came across an error:

build cache is required, but could not be located: GOCACHE is not defined and %LocalAppData% is not defined

I can set GOCACHE or LocalAppData, but that seems unnecessary. LocalAppData should be set on Windows builds.

This will make testing most Go tools on Windows hard, as they will usually require writing to GOCACHE, which falls back to a directory under LocalAppData when unset.

Full logs: https://github.com/mvdan/unparam/runs/219056273

I am not sure what is going on there.  I forked your repo and dumped the environment variables before go was run and LOCALAPPDATA is there https://github.com/chrispat/unparam/commit/fc77b63dbde48b7ba1fdd5fc29e476f59875b94b/checks?check_suite_id=281593816#step:4:58

I don’t know a lot about Go so I am not sure where to start debugging.  Is it possbile your test-script model that runs your go test scripts is not passing the entire environment along when it launches go?

1 Like

You’re absolutely right, this was an oversight on my part. I had another issue with environment variables on Windows, so I just assumed this was an issue on your side too :slight_smile: