gobin: make sure GOPATH gets trimmed before use in path.join

On Windows, `go env GOPATH` keeps the end-line character, making it
unusable (see sample build failure:
478762225 (step):5:62).
This commit is contained in:
francisco souza 2020-03-01 23:59:03 -05:00
parent 4241f446d8
commit 5a59f896b9
No known key found for this signature in database
GPG key ID: 3F6AA3B701F20B3E
3 changed files with 10 additions and 2 deletions

View file

@ -20,4 +20,12 @@ describe('gobin', () => {
const gobinPath = await gobin.getGOBIN('...');
expect(gobinPath).toBe(path.join(gopath, 'bin'));
});
it('should trim ${GOPATH} before using it', async () => {
let trimmed = gopath;
gopath = `${gopath}\r\n`;
const gobinPath = await gobin.getGOBIN('...');
expect(gobinPath).toBe(path.join(trimmed, 'bin'));
});
});