github.com/quay/claircore@v1.5.28/docs/vulnerabilityreport_test.go (about)

     1  package docs
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/quay/claircore"
     7  )
     8  
     9  func Example_vulnerabilityreport() {
    10  	var report claircore.VulnerabilityReport
    11  
    12  	// ANCHOR: example
    13  	for pkgID, vulnIDS := range report.PackageVulnerabilities {
    14  		// get package data structure
    15  		pkg := report.Packages[pkgID]
    16  
    17  		for _, vulnID := range vulnIDS {
    18  			vuln := report.Vulnerabilities[vulnID]
    19  			fmt.Printf("package %+v affected by vuln %+v", pkg, vuln)
    20  		}
    21  	}
    22  	// ANCHOR_END: example
    23  }