@@ -244,10 +244,6 @@ const PyModulesToLookFor = [
244
244
'playwright'
245
245
] ;
246
246
247
- const GoMetaModulesToLookFor = [
248
- 'github.com/Azure/azure-sdk-for-go/sdk/'
249
- ] ;
250
-
251
247
const GoModulesToLookFor = [
252
248
'github.com/Azure/azure-sdk-for-go/sdk/storage/azblob' ,
253
249
'github.com/Azure/azure-sdk-for-go/sdk/storage/azfile' ,
@@ -799,41 +795,33 @@ export class WorkspaceTagsService implements IWorkspaceTagsService {
799
795
} ) ;
800
796
801
797
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
+ }
828
810
}
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 ;
833
818
}
834
819
}
835
820
}
836
821
}
822
+ catch ( e ) {
823
+ // Ignore errors when resolving file or parsing file contents
824
+ }
837
825
} ) ;
838
826
839
827
const pomPromises = getFilePromises ( 'pom.xml' , this . fileService , this . textFileService , content => {
0 commit comments