@@ -54,6 +54,7 @@ const (
5454 TotalConcurrentRequests = 10
5555
5656 MinArtiPassThroughSupport = "7.82.0"
57+ MinArtiGolangSupport = "7.87.0"
5758 MinXrayPassTHroughSupport = "3.92.0"
5859)
5960
@@ -62,20 +63,23 @@ var CurationOutputFormats = []string{string(outFormat.Table), string(outFormat.J
6263var supportedTech = map [techutils.Technology ]func (ca * CurationAuditCommand ) (bool , error ){
6364 techutils .Npm : func (ca * CurationAuditCommand ) (bool , error ) { return true , nil },
6465 techutils .Pip : func (ca * CurationAuditCommand ) (bool , error ) {
65- return ca .checkSupportByVersionOrEnv (techutils .Pip , utils .CurationPipSupport )
66+ return ca .checkSupportByVersionOrEnv (techutils .Pip , utils .CurationSupportFlag , MinArtiPassThroughSupport )
6667 },
6768 techutils .Maven : func (ca * CurationAuditCommand ) (bool , error ) {
68- return ca .checkSupportByVersionOrEnv (techutils .Maven , utils .CurationMavenSupport )
69+ return ca .checkSupportByVersionOrEnv (techutils .Maven , utils .CurationSupportFlag , MinArtiPassThroughSupport )
70+ },
71+ techutils .Go : func (ca * CurationAuditCommand ) (bool , error ) {
72+ return ca .checkSupportByVersionOrEnv (techutils .Go , utils .CurationSupportFlag , MinArtiGolangSupport )
6973 },
7074}
7175
72- func (ca * CurationAuditCommand ) checkSupportByVersionOrEnv (tech techutils.Technology , envName string ) (bool , error ) {
76+ func (ca * CurationAuditCommand ) checkSupportByVersionOrEnv (tech techutils.Technology , envName string , minArtiVersion string ) (bool , error ) {
7377 if flag , err := clientutils .GetBoolEnvValue (envName , false ); flag {
7478 return true , nil
7579 } else if err != nil {
7680 log .Error (err )
7781 }
78- rtVersion , serverDetails , err := ca .getRtVersionAndServiceDetails (tech )
82+ artiVersion , serverDetails , err := ca .getRtVersionAndServiceDetails (tech )
7983 if err != nil {
8084 return false , err
8185 }
@@ -86,7 +90,7 @@ func (ca *CurationAuditCommand) checkSupportByVersionOrEnv(tech techutils.Techno
8690 }
8791
8892 xrayVersionErr := clientutils .ValidateMinimumVersion (clientutils .Xray , xrayVersion , MinXrayPassTHroughSupport )
89- rtVersionErr := clientutils .ValidateMinimumVersion (clientutils .Artifactory , rtVersion , MinArtiPassThroughSupport )
93+ rtVersionErr := clientutils .ValidateMinimumVersion (clientutils .Artifactory , artiVersion , minArtiVersion )
9094 if xrayVersionErr != nil || rtVersionErr != nil {
9195 return false , errors .Join (xrayVersionErr , rtVersionErr )
9296 }
@@ -304,6 +308,7 @@ func (ca *CurationAuditCommand) auditTree(tech techutils.Technology, results map
304308 return err
305309 }
306310 rootNode := depTreeResult .FullDepTrees [0 ]
311+ // we don't pass artiUrl and repo as we don't want to download the package, only to get the name and version.
307312 _ , projectName , projectScope , projectVersion := getUrlNameAndVersionByTech (tech , rootNode , nil , "" , "" )
308313 if projectName == "" {
309314 workPath , err := os .Getwd ()
@@ -312,9 +317,12 @@ func (ca *CurationAuditCommand) auditTree(tech techutils.Technology, results map
312317 }
313318 projectName = filepath .Base (workPath )
314319 }
315-
320+ fullProjectName := projectName
321+ if projectVersion != "" {
322+ fullProjectName += ":" + projectVersion
323+ }
316324 if ca .Progress () != nil {
317- ca .Progress ().SetHeadlineMsg (fmt .Sprintf ("Fetch curation status for %s graph with %v nodes project name: %s:%s " , tech .ToFormal (), len (depTreeResult .FlatTree .Nodes )- 1 , projectName , projectVersion ))
325+ ca .Progress ().SetHeadlineMsg (fmt .Sprintf ("Fetch curation status for %s graph with %v nodes project name: %s" , tech .ToFormal (), len (depTreeResult .FlatTree .Nodes )- 1 , fullProjectName ))
318326 }
319327 if projectScope != "" {
320328 projectName = projectScope + "/" + projectName
@@ -626,7 +634,8 @@ func getUrlNameAndVersionByTech(tech techutils.Technology, node *xrayUtils.Graph
626634 case techutils .Pip :
627635 downloadUrls , name , version = getPythonNameVersion (node .Id , downloadUrlsMap )
628636 return
629-
637+ case techutils .Go :
638+ return getGoNameScopeAndVersion (node .Id , artiUrl , repo )
630639 }
631640 return
632641}
@@ -648,7 +657,21 @@ func getPythonNameVersion(id string, downloadUrlsMap map[string]string) (downloa
648657 return
649658}
650659
651- // input- id: gav://org.apache.tomcat.embed:tomcat-embed-jasper:8.0.33
660+ // input - id: go://github.com/kennygrant/sanitize:v1.2.4
661+ // input - repo: go
662+ // output: downloadUrl: <artiUrl>/api/go/go/github.com/kennygrant/sanitize/@v/v1.2.4.zip
663+ func getGoNameScopeAndVersion (id , artiUrl , repo string ) (downloadUrls []string , name , scope , version string ) {
664+ id = strings .TrimPrefix (id , techutils .Go .String ()+ "://" )
665+ nameVersion := strings .Split (id , ":" )
666+ name = nameVersion [0 ]
667+ if len (nameVersion ) > 1 {
668+ version = nameVersion [1 ]
669+ }
670+ url := strings .TrimSuffix (artiUrl , "/" ) + "/api/go/" + repo + "/" + name + "/@v/" + version + ".zip"
671+ return []string {url }, name , "" , version
672+ }
673+
674+ // input(with classifier) - id: gav://org.apache.tomcat.embed:tomcat-embed-jasper:8.0.33-jdk15
652675// input - repo: libs-release
653676// output - downloadUrl: <arti-url>/libs-release/org/apache/tomcat/embed/tomcat-embed-jasper/8.0.33/tomcat-embed-jasper-8.0.33-jdk15.jar
654677func getMavenNameScopeAndVersion (id , artiUrl , repo string , node * xrayUtils.GraphNode ) (downloadUrls []string , name , scope , version string ) {
0 commit comments