mirror of
https://github.com/actions/setup-go.git
synced 2025-06-28 07:53:43 +00:00
Add JSON output of go env
and some env as strings
Additional outputs are: - GOPATH as `go-path` string - GOMOD as `go-mod` string - GOCACHE as `go-cache` string - GOMODCACHE as `go-mod-cache` string - `go env` as `go-env` JSON
This commit is contained in:
parent
c4c1141886
commit
18710d65d4
5 changed files with 112 additions and 12 deletions
|
@ -143,6 +143,29 @@ describe('setup-go', () => {
|
|||
expect(main.parseGoVersion(goVersionOutput)).toBe('1.16.6');
|
||||
});
|
||||
|
||||
it('can read go env variables', async () => {
|
||||
const goRoot = '/opt/hostedtoolcache/go/1.18.10/x64';
|
||||
const goPath = '/home/runner/go';
|
||||
const goModCache = '/home/runner/go/pkg/mod';
|
||||
const goCache = '/home/runner/.cache/go-build';
|
||||
const goVersion = 'go1.18.10';
|
||||
|
||||
const env = `
|
||||
GOROOT="${goRoot}"
|
||||
GOPATH="${goPath}"
|
||||
GOMODCACHE="${goModCache}"
|
||||
GOCACHE="${goCache}"
|
||||
GOVERSION="${goVersion}"
|
||||
`;
|
||||
const json = JSON.parse(main.convertEnvStringToJson(env));
|
||||
expect(json).toBeDefined();
|
||||
expect(json['GOROOT']).toBe(goRoot);
|
||||
expect(json['GOPATH']).toBe(goPath);
|
||||
expect(json['GOMODCACHE']).toBe(goModCache);
|
||||
expect(json['GOCACHE']).toBe(goCache);
|
||||
expect(json['GOVERSION']).toBe(goVersion);
|
||||
});
|
||||
|
||||
it('can find 1.9.7 from manifest on osx', async () => {
|
||||
os.platform = 'darwin';
|
||||
os.arch = 'x64';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue