Skip to content

Commit af15aac

Browse files
committed
Removing meta modules as Go does not need it
1 parent b62087b commit af15aac

File tree

1 file changed

+22
-34
lines changed

1 file changed

+22
-34
lines changed

src/vs/workbench/contrib/tags/electron-sandbox/workspaceTagsService.ts

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,6 @@ const PyModulesToLookFor = [
244244
'playwright'
245245
];
246246

247-
const GoMetaModulesToLookFor = [
248-
'github.com/Azure/azure-sdk-for-go/sdk/'
249-
];
250-
251247
const GoModulesToLookFor = [
252248
'github.com/Azure/azure-sdk-for-go/sdk/storage/azblob',
253249
'github.com/Azure/azure-sdk-for-go/sdk/storage/azfile',
@@ -799,41 +795,33 @@ export class WorkspaceTagsService implements IWorkspaceTagsService {
799795
});
800796

801797
const goModPromises = getFilePromises('go.mod', this.fileService, this.textFileService, content => {
802-
// TODO: Richard to write the code for parsing the go.mod file
803-
// look for everything in require() and get the string value only discard version
804-
const lines: string[] = splitLines(content.value);
805-
let firstRequireBlockFound: boolean = false;
806-
807-
for (let i = 0; i < lines.length; i++) {
808-
const line: string = lines[i].trim();
809-
810-
if (line.startsWith('require (')) {
811-
if (!firstRequireBlockFound) {
812-
firstRequireBlockFound = true;
813-
continue;
814-
} else {
815-
break;
816-
}
817-
}
818-
819-
if (line.startsWith(')')) {
820-
break;
821-
}
822-
823-
if (firstRequireBlockFound && line !== '') {
824-
const packageName: string = line.split(' ')[0].trim();
825-
// copied from line 728 function addPythonTags
826-
if (GoModulesToLookFor.indexOf(packageName) > -1) {
827-
tags['workspace.go.mod' + packageName] = true;
798+
try {
799+
const lines: string[] = splitLines(content.value);
800+
let firstRequireBlockFound: boolean = false;
801+
for (let i = 0; i < lines.length; i++) {
802+
const line: string = lines[i].trim();
803+
if (line.startsWith('require (')) {
804+
if (!firstRequireBlockFound) {
805+
firstRequireBlockFound = true;
806+
continue;
807+
} else {
808+
break;
809+
}
828810
}
829-
// not sure if we should keep this
830-
for (const metaModule of GoMetaModulesToLookFor) {
831-
if (packageName.startsWith(metaModule)) {
832-
tags['workspace.go.mod' + metaModule] = true;
811+
if (line.startsWith(')')) {
812+
break;
813+
}
814+
if (firstRequireBlockFound && line !== '') {
815+
const packageName: string = line.split(' ')[0].trim();
816+
if (GoModulesToLookFor.indexOf(packageName) > -1) {
817+
tags['workspace.go.mod' + packageName] = true;
833818
}
834819
}
835820
}
836821
}
822+
catch (e) {
823+
// Ignore errors when resolving file or parsing file contents
824+
}
837825
});
838826

839827
const pomPromises = getFilePromises('pom.xml', this.fileService, this.textFileService, content => {

0 commit comments

Comments
 (0)