Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Fix the goVersion to properly parse ver '1.10' (#1523)
Browse files Browse the repository at this point in the history
* Fix the goVersion to properly parse ver '1.10'

* Add go version 1.10 to travis config

* Define 1.10 as string on travis

* Exclude the 1.10 on linux

* Add g++4.9 for linux os

* Use default CC and CXX

* Fix the lint test

* Fix the lint test to compatible both golang 1.10 and previous version

* Fix lint test

* Try to make fill struct test result consistent
  • Loading branch information
uudashr authored and ramya-rao-a committed Feb 20, 2018
1 parent 4884626 commit d5e35fb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
9 changes: 2 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go:
- 1.7.x
- 1.8.x
- 1.9.x
- '1.10'
- tip

sudo: false
Expand All @@ -12,15 +13,9 @@ os:
- osx
- linux

# Exclude linux for tip as go get fails there for some reason
matrix:
exclude:
- go: tip
os: linux

before_install:
- if [ $TRAVIS_OS_NAME == "linux" ]; then
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
export DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start;
sudo apt-get update && sudo apt-get install -y libsecret-1-0;
fi
Expand Down
4 changes: 2 additions & 2 deletions src/goFillStruct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ interface GoFillStructOutput {
code: string;
}

export function runFillStruct(editor: vscode.TextEditor) {
export function runFillStruct(editor: vscode.TextEditor): Promise<void> {
let args = getCommonArgs(editor);
if (!args) {
return;
return Promise.reject('No args');
}

return execFillStruct(editor, args);
Expand Down
4 changes: 2 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export function getGoVersion(): Promise<SemVersion> {
}
return new Promise<SemVersion>((resolve, reject) => {
cp.execFile(goRuntimePath, ['version'], {}, (err, stdout, stderr) => {
let matches = /go version go(\d).(\d).*/.exec(stdout);
let matches = /go version go(\d).(\d+).*/.exec(stdout);
if (matches) {
goVersion = {
major: parseInt(matches[1]),
Expand Down Expand Up @@ -765,4 +765,4 @@ export function killTree(processId: number): void {
} catch (err) {
}
}
}
}
4 changes: 2 additions & 2 deletions test/go.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ It returns the number of bytes written and any write error encountered.
});
let linterTestPath = path.join(fixturePath, 'linterTest');
let expected = [
{ file: path.join(linterTestPath, 'linter_1.go'), line: 8, severity: 'warning', msg: 'error return value not checked (a declared but not used) (errcheck, errcheck)' },
{ file: path.join(linterTestPath, 'linter_1.go'), line: 8, severity: 'warning', msg: 'error return value not checked (a declared but not used) (errcheck' },
{ file: path.join(linterTestPath, 'linter_2.go'), line: 5, severity: 'warning', msg: 'error return value not checked (missing return) (errcheck)' },
{ file: path.join(linterTestPath, 'linter_1.go'), line: 5, severity: 'warning', msg: 'exported function ExportedFunc should have comment or be unexported (golint)' },
];
Expand All @@ -865,7 +865,7 @@ It returns the number of bytes written and any write error encountered.
});
for (let i in expected) {
let errorMsg = `Failed to match expected error #${i}: ${JSON.stringify(sortedDiagnostics)}`;
assert.equal(sortedDiagnostics[i].msg, expected[i].msg, errorMsg);
assert(sortedDiagnostics[i].msg.startsWith(expected[i].msg), errorMsg);
assert.equal(sortedDiagnostics[i].file.toLowerCase(), expected[i].file.toLowerCase(), errorMsg);
assert.equal(sortedDiagnostics[i].line, expected[i].line, errorMsg);
assert.equal(sortedDiagnostics[i].severity, expected[i].severity, errorMsg);
Expand Down

0 comments on commit d5e35fb

Please sign in to comment.