Skip to content

Commit 57683f2

Browse files
h9jianggopherbot
authored andcommitted
extension/src/developerSurvey: append source query parameter to url
For #2891 Change-Id: I54d017eaa53c94606171993560263c8c52d6afdd Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/697455 Auto-Submit: Hongxiang Jiang <[email protected]> Reviewed-by: Todd Kulesza <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]>
1 parent 631364b commit 57683f2

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

extension/src/developerSurvey/config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as cp from 'child_process';
77
import * as fs from 'fs';
88
import * as path from 'path';
99
import * as util from 'util';
10+
import { URL } from 'url';
1011
import { getStateConfig } from '../goSurvey';
1112
import { getBinPath } from '../util';
1213
import { updateGlobalState } from '../stateUtils';
@@ -100,6 +101,13 @@ export async function getLatestDeveloperSurvey(now: Date): Promise<DeveloperSurv
100101
lastDateUpdated: now
101102
};
102103

104+
// The survey URL stored in config.json is the raw survey URL. We add the
105+
// s=v (for vscode) query parameter to identify the source of the survey
106+
// respondent.
107+
const url = new URL(config.URL);
108+
url.searchParams.append('s', 'v');
109+
config.URL = url.toString();
110+
103111
updateGlobalState(DEVELOPER_SURVEY_CONFIG_STATE_KEY, JSON.stringify(newState));
104112

105113
outputChannel.info(`Using fetched Go developer survey: ${newState.version}`);

extension/test/gopls/survey.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ suite('developer survey tests', () => {
112112
const oldConfig: config.DeveloperSurveyConfig = {
113113
StartDate: new Date('2025-07-01T00:00:00Z'),
114114
EndDate: new Date('2025-08-01T00:00:00Z'),
115-
URL: 'https://google.com/survey/old'
115+
URL: 'https://google.com/survey/old?s=v'
116116
};
117117

118118
const newConfig = {
119119
StartDate: new Date('2025-09-01T00:00:00Z'),
120120
EndDate: new Date('2025-10-01T00:00:00Z'),
121-
URL: 'https://google.com/survey/new'
121+
URL: 'https://google.com/survey/new?s=v'
122122
};
123123

124124
// old state, now, module survey config => return survey config

0 commit comments

Comments
 (0)