github.com/quay/claircore@v1.5.28/libvuln/examples_test.go (about) 1 package libvuln_test 2 3 import ( 4 "context" 5 "time" 6 7 "github.com/quay/claircore" 8 "github.com/quay/claircore/libvuln" 9 ) 10 11 func ExampleLibvuln() { 12 ctx := context.TODO() 13 opts := &libvuln.Options{ 14 // see definition for configuration option 15 } 16 lib, err := libvuln.New(ctx, opts) 17 if err != nil { 18 panic(err) 19 } 20 21 for range time.Tick(5 * time.Second) { 22 ok, err := lib.Initialized(ctx) 23 if err != nil { 24 panic(err) 25 } 26 if ok { 27 break 28 } 29 } 30 31 ir := &claircore.IndexReport{} 32 vr, err := lib.Scan(ctx, ir) 33 if err != nil { 34 panic(err) 35 } 36 _ = vr 37 }