Skip to content
This repository was archived by the owner on Sep 24, 2021. It is now read-only.

Commit d5e35fb

Browse files
uudashrramya-rao-a
authored andcommitted
Fix the goVersion to properly parse ver '1.10' (microsoft#1523)
* 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
1 parent 4884626 commit d5e35fb

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

.travis.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go:
44
- 1.7.x
55
- 1.8.x
66
- 1.9.x
7+
- '1.10'
78
- tip
89

910
sudo: false
@@ -12,15 +13,9 @@ os:
1213
- osx
1314
- linux
1415

15-
# Exclude linux for tip as go get fails there for some reason
16-
matrix:
17-
exclude:
18-
- go: tip
19-
os: linux
20-
2116
before_install:
2217
- if [ $TRAVIS_OS_NAME == "linux" ]; then
23-
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
18+
export DISPLAY=:99.0;
2419
sh -e /etc/init.d/xvfb start;
2520
sudo apt-get update && sudo apt-get install -y libsecret-1-0;
2621
fi

src/goFillStruct.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ interface GoFillStructOutput {
1616
code: string;
1717
}
1818

19-
export function runFillStruct(editor: vscode.TextEditor) {
19+
export function runFillStruct(editor: vscode.TextEditor): Promise<void> {
2020
let args = getCommonArgs(editor);
2121
if (!args) {
22-
return;
22+
return Promise.reject('No args');
2323
}
2424

2525
return execFillStruct(editor, args);

src/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export function getGoVersion(): Promise<SemVersion> {
197197
}
198198
return new Promise<SemVersion>((resolve, reject) => {
199199
cp.execFile(goRuntimePath, ['version'], {}, (err, stdout, stderr) => {
200-
let matches = /go version go(\d).(\d).*/.exec(stdout);
200+
let matches = /go version go(\d).(\d+).*/.exec(stdout);
201201
if (matches) {
202202
goVersion = {
203203
major: parseInt(matches[1]),
@@ -765,4 +765,4 @@ export function killTree(processId: number): void {
765765
} catch (err) {
766766
}
767767
}
768-
}
768+
}

test/go.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ It returns the number of bytes written and any write error encountered.
851851
});
852852
let linterTestPath = path.join(fixturePath, 'linterTest');
853853
let expected = [
854-
{ file: path.join(linterTestPath, 'linter_1.go'), line: 8, severity: 'warning', msg: 'error return value not checked (a declared but not used) (errcheck, errcheck)' },
854+
{ file: path.join(linterTestPath, 'linter_1.go'), line: 8, severity: 'warning', msg: 'error return value not checked (a declared but not used) (errcheck' },
855855
{ file: path.join(linterTestPath, 'linter_2.go'), line: 5, severity: 'warning', msg: 'error return value not checked (missing return) (errcheck)' },
856856
{ file: path.join(linterTestPath, 'linter_1.go'), line: 5, severity: 'warning', msg: 'exported function ExportedFunc should have comment or be unexported (golint)' },
857857
];
@@ -865,7 +865,7 @@ It returns the number of bytes written and any write error encountered.
865865
});
866866
for (let i in expected) {
867867
let errorMsg = `Failed to match expected error #${i}: ${JSON.stringify(sortedDiagnostics)}`;
868-
assert.equal(sortedDiagnostics[i].msg, expected[i].msg, errorMsg);
868+
assert(sortedDiagnostics[i].msg.startsWith(expected[i].msg), errorMsg);
869869
assert.equal(sortedDiagnostics[i].file.toLowerCase(), expected[i].file.toLowerCase(), errorMsg);
870870
assert.equal(sortedDiagnostics[i].line, expected[i].line, errorMsg);
871871
assert.equal(sortedDiagnostics[i].severity, expected[i].severity, errorMsg);

0 commit comments

Comments
 (0)