mirror of
https://github.com/actions/setup-go.git
synced 2025-07-25 16:08:29 +02:00

On Windows, `go env GOPATH` keeps the end-line character, making it
unusable (see sample build failure:
478762225 (step)
:5:62).
13 lines
447 B
TypeScript
13 lines
447 B
TypeScript
import * as childProcess from 'child_process';
|
|
import * as path from 'path';
|
|
import {promisify} from 'util';
|
|
|
|
const execFile = promisify(childProcess.execFile);
|
|
|
|
export async function getGOBIN(installDir: string): Promise<string> {
|
|
const goExecutable = path.join(installDir, 'bin', 'go');
|
|
|
|
const result = await execFile(goExecutable, ['env', 'GOPATH']);
|
|
const gopath = result.stdout.replace(/\s+$/, '');
|
|
return path.join(gopath, 'bin');
|
|
}
|