From 16a053732422e5a5286c907962696ec6bf6a59d8 Mon Sep 17 00:00:00 2001 From: Nuruddin Ashr Date: Mon, 19 Feb 2018 17:09:59 +0700 Subject: [PATCH 01/10] Fix the goVersion to properly parse ver '1.10' --- src/util.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util.ts b/src/util.ts index b19e03730..7837db52f 100644 --- a/src/util.ts +++ b/src/util.ts @@ -197,7 +197,7 @@ export function getGoVersion(): Promise { } return new Promise((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]), @@ -765,4 +765,4 @@ export function killTree(processId: number): void { } catch (err) { } } -} \ No newline at end of file +} From 3bf1e77f41438ce8a29d81999e45256f2713d656 Mon Sep 17 00:00:00 2001 From: Nuruddin Ashr Date: Mon, 19 Feb 2018 17:36:45 +0700 Subject: [PATCH 02/10] Add go version 1.10 to travis config --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 4f42a222d..8b9e25a94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ go: - 1.7.x - 1.8.x - 1.9.x + - 1.10.x - tip sudo: false From 131fe26b6e8902276cd724413ecffae1994d65a1 Mon Sep 17 00:00:00 2001 From: Nuruddin Ashr Date: Mon, 19 Feb 2018 17:50:59 +0700 Subject: [PATCH 03/10] Define 1.10 as string on travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8b9e25a94..93d857598 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ go: - 1.7.x - 1.8.x - 1.9.x - - 1.10.x + - '1.10' - tip sudo: false From ac76000ee666eaede77b2fb0f13514f3ed5adf9e Mon Sep 17 00:00:00 2001 From: Nuruddin Ashr Date: Mon, 19 Feb 2018 18:25:34 +0700 Subject: [PATCH 04/10] Exclude the 1.10 on linux --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 93d857598..b107ac7cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,8 @@ os: # Exclude linux for tip as go get fails there for some reason matrix: exclude: + - go: '1.10' + os: linux - go: tip os: linux From 97bec5440b1cd04d477a80c764e49ce1cbd118ac Mon Sep 17 00:00:00 2001 From: Nuruddin Ashr Date: Mon, 19 Feb 2018 18:28:01 +0700 Subject: [PATCH 05/10] Add g++4.9 for linux os --- .travis.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b107ac7cb..2531eb34a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,11 +13,17 @@ os: - osx - linux -# Exclude linux for tip as go get fails there for some reason matrix: + include: + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.9 + # Exclude linux for tip as go get fails there for some reason exclude: - - go: '1.10' - os: linux - go: tip os: linux From 3a6e3c4eebae03157aaf879a7a55bea23a669551 Mon Sep 17 00:00:00 2001 From: Nuruddin Ashr Date: Mon, 19 Feb 2018 23:05:59 +0700 Subject: [PATCH 06/10] Use default CC and CXX --- .travis.yml | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2531eb34a..eef10b1f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,23 +13,9 @@ os: - osx - linux -matrix: - include: - - os: linux - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-4.9 - # Exclude linux for tip as go get fails there for some reason - 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 From 131ec4e00a76b093476802700a06ecd3366ec3a8 Mon Sep 17 00:00:00 2001 From: Nuruddin Ashr Date: Tue, 20 Feb 2018 00:13:52 +0700 Subject: [PATCH 07/10] Fix the lint test --- test/go.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/go.test.ts b/test/go.test.ts index 3901388d5..0923d5682 100644 --- a/test/go.test.ts +++ b/test/go.test.ts @@ -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)' }, ]; From 8a0d055bfba8ac8c48f98f639a97cb949f4ec6eb Mon Sep 17 00:00:00 2001 From: Nuruddin Ashr Date: Tue, 20 Feb 2018 00:34:15 +0700 Subject: [PATCH 08/10] Fix the lint test to compatible both golang 1.10 and previous version --- test/go.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/go.test.ts b/test/go.test.ts index 0923d5682..00e958031 100644 --- a/test/go.test.ts +++ b/test/go.test.ts @@ -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); From bf9d4db7c060e5c9a66d1f097a84dade91a352f2 Mon Sep 17 00:00:00 2001 From: Nuruddin Ashr Date: Tue, 20 Feb 2018 00:44:51 +0700 Subject: [PATCH 09/10] Fix lint test --- test/go.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/go.test.ts b/test/go.test.ts index 00e958031..2537ec509 100644 --- a/test/go.test.ts +++ b/test/go.test.ts @@ -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)' }, + { 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)' }, ]; From 0c0d80762b8e25c0c39421aa89cbc3ee557489a2 Mon Sep 17 00:00:00 2001 From: Nuruddin Ashr Date: Tue, 20 Feb 2018 01:12:30 +0700 Subject: [PATCH 10/10] Try to make fill struct test result consistent --- src/goFillStruct.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/goFillStruct.ts b/src/goFillStruct.ts index 93a906f04..d8d51adce 100644 --- a/src/goFillStruct.ts +++ b/src/goFillStruct.ts @@ -16,10 +16,10 @@ interface GoFillStructOutput { code: string; } -export function runFillStruct(editor: vscode.TextEditor) { +export function runFillStruct(editor: vscode.TextEditor): Promise { let args = getCommonArgs(editor); if (!args) { - return; + return Promise.reject('No args'); } return execFillStruct(editor, args);