@@ -244,6 +244,32 @@ const PyModulesToLookFor = [
244
244
'playwright'
245
245
] ;
246
246
247
+ const GoMetaModulesToLookFor = [
248
+ 'github.com/Azure/azure-sdk-for-go/sdk/'
249
+ ] ;
250
+
251
+ const GoModulesToLookFor = [
252
+ 'github.com/Azure/azure-sdk-for-go/sdk/storage/azblob' ,
253
+ 'github.com/Azure/azure-sdk-for-go/sdk/storage/azfile' ,
254
+ 'github.com/Azure/azure-sdk-for-go/sdk/storage/azqueue' ,
255
+ 'github.com/Azure/azure-sdk-for-go/sdk/tracing/azotel' ,
256
+ 'github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azadmin' ,
257
+ 'github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azcertificates' ,
258
+ 'github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys' ,
259
+ 'github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets' ,
260
+ 'github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery' ,
261
+ 'github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs' ,
262
+ 'github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus' ,
263
+ 'github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig' ,
264
+ 'github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos' ,
265
+ 'github.com/Azure/azure-sdk-for-go/sdk/data/aztables' ,
266
+ 'github.com/Azure/azure-sdk-for-go/sdk/containers/azcontainerregistry' ,
267
+ 'github.com/Azure/azure-sdk-for-go/sdk/cognitiveservices/azopenai' ,
268
+ 'github.com/Azure/azure-sdk-for-go/sdk/azidentity' ,
269
+ 'github.com/Azure/azure-sdk-for-go/sdk/azcore'
270
+ ] ;
271
+
272
+
247
273
export class WorkspaceTagsService implements IWorkspaceTagsService {
248
274
declare readonly _serviceBrand : undefined ;
249
275
private _tags : Tags | undefined ;
@@ -566,6 +592,24 @@ export class WorkspaceTagsService implements IWorkspaceTagsService {
566
592
"workspace.py.azure-security-attestation" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
567
593
"workspace.py.azure-data-nspkg" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true },
568
594
"workspace.py.azure-data-tables" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
595
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/storage/azblob" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
596
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/storage/azfile" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
597
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/storage/azqueue" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
598
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/tracing/azotel" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
599
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azadmin" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
600
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azcertificates" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
601
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
602
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
603
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
604
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
605
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
606
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
607
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
608
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/data/aztables" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
609
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/containers/azcontainerregistry" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
610
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/cognitiveservices/azopenai" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
611
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/azidentity" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
612
+ "workspace.go.mod.github.com/Azure/azure-sdk-for-go/sdk/azcore" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
569
613
}
570
614
*/
571
615
private async resolveWorkspaceTags ( ) : Promise < Tags > {
@@ -624,6 +668,8 @@ export class WorkspaceTagsService implements IWorkspaceTagsService {
624
668
tags [ 'workspace.py.app' ] = nameSet . has ( 'app.py' ) ;
625
669
tags [ 'workspace.py.pyproject' ] = nameSet . has ( 'pyproject.toml' ) ;
626
670
671
+ tags [ 'workspace.go.mod' ] = nameSet . has ( 'go.mod' ) ;
672
+
627
673
const mainActivity = nameSet . has ( 'mainactivity.cs' ) || nameSet . has ( 'mainactivity.fs' ) ;
628
674
const appDelegate = nameSet . has ( 'appdelegate.cs' ) || nameSet . has ( 'appdelegate.fs' ) ;
629
675
const androidManifest = nameSet . has ( 'androidmanifest.xml' ) ;
@@ -752,6 +798,29 @@ export class WorkspaceTagsService implements IWorkspaceTagsService {
752
798
}
753
799
} ) ;
754
800
801
+ 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 dependencies : string [ ] = splitLines ( content . value ) ;
805
+ for ( const dependency of dependencies ) {
806
+ // Dependencies in requirements.txt can have 3 formats: `foo==3.1, foo>=3.1, foo`
807
+ const format1 = dependency . split ( '==' ) ;
808
+ const format2 = dependency . split ( '>=' ) ;
809
+ const packageName = ( format1 . length === 2 ? format1 [ 0 ] : format2 [ 0 ] ) . trim ( ) ;
810
+
811
+ // copied from line 728 function addPythonTags
812
+ if ( GoModulesToLookFor . indexOf ( packageName ) > - 1 ) {
813
+ tags [ 'workspace.go.mod' + packageName ] = true ;
814
+ }
815
+ // not sure if we should keep this
816
+ for ( const metaModule of GoMetaModulesToLookFor ) {
817
+ if ( packageName . startsWith ( metaModule ) ) {
818
+ tags [ 'workspace.go.mod' + metaModule ] = true ;
819
+ }
820
+ }
821
+ }
822
+ } ) ;
823
+
755
824
const pomPromises = getFilePromises ( 'pom.xml' , this . fileService , this . textFileService , content => {
756
825
try {
757
826
let dependenciesContent ;
@@ -792,7 +861,7 @@ export class WorkspaceTagsService implements IWorkspaceTagsService {
792
861
} ) ;
793
862
} ) ;
794
863
795
- return Promise . all ( [ ...packageJsonPromises , ...requirementsTxtPromises , ...pipfilePromises , ...pomPromises , ...gradlePromises , ...androidPromises ] ) . then ( ( ) => tags ) ;
864
+ return Promise . all ( [ ...packageJsonPromises , ...requirementsTxtPromises , ...pipfilePromises , ...pomPromises , ...gradlePromises , ...androidPromises , ... goModPromises ] ) . then ( ( ) => tags ) ;
796
865
} ) ;
797
866
}
798
867
0 commit comments