Revert "extension/src/welcome: fix 'go.showWelcome' setting interpretation"

This reverts commit f8173bc90af694c2d1d7db25e6da125378149e96.

Reason: broke the welcome page suppression based on isInCloudIDE
Change-Id: If042f5269754f7dd6cb4c1b2473979d5e11247b3
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/581117
Commit-Queue: Hyang-Ah Hana Kim <hyangah@gmail.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
diff --git a/extension/src/welcome.ts b/extension/src/welcome.ts
index d68ed75..b0afe12 100644
--- a/extension/src/welcome.ts
+++ b/extension/src/welcome.ts
@@ -12,7 +12,7 @@
 import semver = require('semver');
 import { extensionId } from './const';
 import { GoExtensionContext } from './context';
-import { extensionInfo, getGoConfig } from './config';
+import { extensionInfo } from './config';
 import { getFromGlobalState, updateGlobalState } from './stateUtils';
 import { createRegisterCommand } from './commands';
 
@@ -29,7 +29,11 @@
 				}
 			});
 		}
-		showGoWelcomePage();
+
+		// Show the Go welcome page on update.
+		if (!extensionInfo.isInCloudIDE && vscode.workspace.getConfiguration('go.showWelcome')) {
+			showGoWelcomePage();
+		}
 	}
 
 	public static currentPanel: WelcomePanel | undefined;
@@ -274,9 +278,6 @@
 }
 
 export function shouldShowGoWelcomePage(showVersions: string[], newVersion: string, oldVersion: string): boolean {
-	if (!extensionInfo.isInCloudIDE && getGoConfig().get('showWelcome') === false) {
-		return false;
-	}
 	if (newVersion === oldVersion) {
 		return false;
 	}
diff --git a/extension/test/integration/welcome.test.ts b/extension/test/integration/welcome.test.ts
index 72885ae..78afe71 100644
--- a/extension/test/integration/welcome.test.ts
+++ b/extension/test/integration/welcome.test.ts
@@ -8,70 +8,52 @@
 import { shouldShowGoWelcomePage } from '../../src/welcome';
 import { extensionId } from '../../src/const';
 import { WelcomePanel } from '../../src/welcome';
-import sinon = require('sinon');
-import * as config from '../../src/config';
-import { MockCfg } from '../mocks/MockCfg';
 
 suite('WelcomePanel Tests', () => {
-	let sandbox: sinon.SinonSandbox;
-	setup(() => {
-		sandbox = sinon.createSandbox();
-	});
-	teardown(() => sandbox.restore());
-
-	// 0:showVersions, 1:newVersion, 2:oldVersion, 3: showWelcome, 4:expected
-	//
-	// If showWelcome is false, then expected has to be false.
-	// Otherwise, expected is true if (and only if) newVersion occurs in showVersions
-	// and is newer than oldVersion (as semantic versions).
-	type testCase = [string[], string, string, boolean, boolean];
+	// 0:showVersions, 1:newVersion, 2:oldVersion, 3:expected
+	type testCase = [string[], string, string, boolean];
 	const testCases: testCase[] = [
-		[[], '0.22.0', '0.0.0', true, false],
-		[[], '0.22.0', '0.21.0', true, false],
-		[[], '0.22.0', '0.22.0-rc.1', true, false],
-		[[], '0.22.0', '0.22.0', true, false],
-		[[], '0.22.0', '0.23.0', true, false],
+		[[], '0.22.0', '0.0.0', false],
+		[[], '0.22.0', '0.21.0', false],
+		[[], '0.22.0', '0.22.0-rc.1', false],
+		[[], '0.22.0', '0.22.0', false],
+		[[], '0.22.0', '0.23.0', false],
 
-		[['0.22.0'], '0.22.0', '0.0.0', true, true],
-		[['0.22.0'], '0.22.0', '0.0.0', false, false],
-		[['0.22.0'], '0.22.0', '0.21.0-rc.1', true, true],
-		[['0.22.0'], '0.22.0', '0.21.0', true, true],
-		[['0.22.0'], '0.22.0', '0.22.0-rc.1', true, true],
-		[['0.22.0'], '0.22.0', '0.22.0', true, false],
-		[['0.22.0'], '0.22.0', '0.22.1', true, false],
-		[['0.22.0'], '0.22.0', '0.23.0', true, false],
-		[['0.22.0'], '0.22.0', '1.0.0', true, false],
-		[['0.22.0'], '0.22.0', '2021.1.100', true, false],
+		[['0.22.0'], '0.22.0', '0.0.0', true],
+		[['0.22.0'], '0.22.0', '0.21.0-rc.1', true],
+		[['0.22.0'], '0.22.0', '0.21.0', true],
+		[['0.22.0'], '0.22.0', '0.22.0-rc.1', true],
+		[['0.22.0'], '0.22.0', '0.22.0', false],
+		[['0.22.0'], '0.22.0', '0.22.1', false],
+		[['0.22.0'], '0.22.0', '0.23.0', false],
+		[['0.22.0'], '0.22.0', '1.0.0', false],
+		[['0.22.0'], '0.22.0', '2021.1.100', false],
 
-		[['0.22.0'], '0.22.0-rc.2', '0.0.0', true, true],
-		[['0.22.0'], '0.22.0-rc.2', '0.21.0-rc.1', true, true],
-		[['0.22.0'], '0.22.0-rc.2', '0.21.0', true, true],
-		[['0.22.0'], '0.22.0-rc.2', '0.22.0-rc.1', true, true],
-		[['0.22.0'], '0.22.0-rc.2', '0.22.0-rc.2', true, false],
-		[['0.22.0'], '0.22.0-rc.2', '0.22.0-rc.3', true, true],
-		[['0.22.0'], '0.22.0-rc.2', '0.22.0', true, true],
-		[['0.22.0'], '0.22.0-rc.2', '0.22.1', true, false],
-		[['0.22.0'], '0.22.0-rc.2', '0.23.0', true, false],
-		[['0.22.0'], '0.22.0-rc.2', '1.0.0', true, false],
-		[['0.22.0'], '0.22.0-rc.2', '2021.1.100', true, false],
+		[['0.22.0'], '0.22.0-rc.2', '0.0.0', true],
+		[['0.22.0'], '0.22.0-rc.2', '0.21.0-rc.1', true],
+		[['0.22.0'], '0.22.0-rc.2', '0.21.0', true],
+		[['0.22.0'], '0.22.0-rc.2', '0.22.0-rc.1', true],
+		[['0.22.0'], '0.22.0-rc.2', '0.22.0-rc.2', false],
+		[['0.22.0'], '0.22.0-rc.2', '0.22.0-rc.3', true],
+		[['0.22.0'], '0.22.0-rc.2', '0.22.0', true],
+		[['0.22.0'], '0.22.0-rc.2', '0.22.1', false],
+		[['0.22.0'], '0.22.0-rc.2', '0.23.0', false],
+		[['0.22.0'], '0.22.0-rc.2', '1.0.0', false],
+		[['0.22.0'], '0.22.0-rc.2', '2021.1.100', false],
 
-		[['0.22.0'], '0.22.1', '0.0.0', true, false],
-		[['0.22.0'], '0.22.1', '0.21.0-rc.1', true, false],
-		[['0.22.0'], '0.22.1', '0.21.0', true, false],
-		[['0.22.0'], '0.22.1', '0.22.0-rc.1', true, false],
-		[['0.22.0'], '0.22.1', '0.22.0', true, false],
-		[['0.22.0'], '0.22.1', '0.23.0', true, false],
-		[['0.22.0'], '0.22.1', '1.0.0', true, false],
-		[['0.22.0'], '0.22.1', '2021.1.100', true, false]
+		[['0.22.0'], '0.22.1', '0.0.0', false],
+		[['0.22.0'], '0.22.1', '0.21.0-rc.1', false],
+		[['0.22.0'], '0.22.1', '0.21.0', false],
+		[['0.22.0'], '0.22.1', '0.22.0-rc.1', false],
+		[['0.22.0'], '0.22.1', '0.22.0', false],
+		[['0.22.0'], '0.22.1', '0.23.0', false],
+		[['0.22.0'], '0.22.1', '1.0.0', false],
+		[['0.22.0'], '0.22.1', '2021.1.100', false]
 	];
 	testCases.forEach((c: testCase) => {
-		const [showVersions, newVersion, oldVersion, showWelcome, expected] = c;
-		test(`shouldShowGoWelcomePage(${JSON.stringify(
-			showVersions
-		)}, ${newVersion}, ${oldVersion}, (showWelcome=${showWelcome}))`, () => {
-			const goConfig = new MockCfg([]);
-			sandbox.stub(config, 'getGoConfig').returns(goConfig);
-			sinon.stub(goConfig, 'get').withArgs('showWelcome').returns(showWelcome);
+		const [showVersions, newVersion, oldVersion, expected] = c;
+
+		test(`shouldShowGoWelcomePage(${JSON.stringify(showVersions)}, ${newVersion}, ${oldVersion})`, () => {
 			assert.strictEqual(shouldShowGoWelcomePage(showVersions, newVersion, oldVersion), expected);
 		});
 	});