Skip to main content

The Decoration Pipeline

Beyond scanning, pkg/scanoss is the SDK for the SCANOSS decoration services, the same ones behind SCANOSS-CLI’s decoration commands. The pipeline runs a configurable set of them over the same PURLs (Package URLs, the pkg:type/namespace/name@version scheme identifying each component) in parallel, reports per-service progress, and returns one object keyed by service. Chunking and the worker pool are handled internally.
pipe.Run only returns an error when every service in the pipeline failed. A partial failure, one service down, the rest fine, comes back as a successful result with the failing service’s error recorded in res.Errors, so one bad service doesn’t discard the results you did get.

Component Version Requirements

scanoss.Components(...), used above, is a shorthand that builds a component list from bare PURLs, no version attached. That’s fine for lookups where the latest or any version will do. When a version matters, build the components directly instead:
Either form of comps works anywhere a decoration call takes one, the pipeline, a single service, or WithDecorationReporter, shown next.

Per-Service Progress

Implement DecorationReporter and hand it to the call. Every update carries the service that produced it, so one receiver renders them all, and since services run concurrently, it must be safe for concurrent use:
The per-service methods take it too:

A Single Service, Without the Pipeline

Each decoration service is a grouped handle on the client, useful when you only need one and the pipeline’s parallel fan-out would be overkill:

Scanning from the SDK

Logging

The SDK writes nothing until you ask it to, it won’t put lines in your program’s output uninvited. One call covers every package it’s built from, not just the client:
At Debug this also explains file selection, which rules a collection applied, and which rule excluded each file:
Call SetLogger during initialisation: it’s process-wide, so changing it while calls are in flight can split a run’s output across two destinations.

Request Tuning

Beyond APIKey, APIURL, and the proxy/TLS fields covered in Authentication, Config exposes the request behaviour itself: All are zero-value-safe: an unset field falls back to its default, so you only need to set what you’re overriding.