Documentation ¶
Overview ¶
Package download is responsible for downloading vendored modules.
Index ¶
Constants ¶
const ( // ErrAlreadyVendored indicates that a module is already vendored. ErrAlreadyVendored errors.Kind = "module is already vendored" // ErrUnsupportedModSrc indicates that the module source is not supported. ErrUnsupportedModSrc errors.Kind = "unsupported module source" // ErrDownloadMod indicates that an error occurred while trying to download a module. ErrDownloadMod errors.Kind = "downloading module" // ErrModRefEmpty indicates that a module source had no reference on it. ErrModRefEmpty errors.Kind = "module ref is empty" )
Variables ¶
This section is empty.
Functions ¶
func HandleVendorRequests ¶
func HandleVendorRequests( rootdir string, vendorRequests <-chan event.VendorRequest, progressEvents ProgressEventStream, ) <-chan Report
HandleVendorRequests starts a goroutine that will handle all vendor requests sent on vendorRequests, calling Vendor for each event and sending one report result for each event on the returned Report channel.
It will read events from vendorRequests until it is closed. If progressEvents is nil it will not send any progress events, like Vendor.
When vendorRequests is closed it will close the returned Report channel, indicating that no more processing will be done.
func MergeVendorReports ¶
MergeVendorReports will read all reports from the given reports channel, merge them and send the merged result on the returned channel and then close it. The returned channel always produce a single final report after the given reports channel is closed.
Types ¶
type IgnoredVendor ¶
IgnoredVendor describes an ignored dependency.
type ProgressEventStream ¶
type ProgressEventStream event.Stream[event.VendorProgress]
ProgressEventStream is a stream of vendor related events.
func NewEventStream ¶
func NewEventStream() ProgressEventStream
NewEventStream creates a new event stream.
func (ProgressEventStream) Send ¶
func (e ProgressEventStream) Send(pe event.VendorProgress) bool
Send send a progress event.
type Report ¶
type Report struct { Vendored map[project.Path]Vendored Ignored []IgnoredVendor Error error // contains filtered or unexported fields }
Report with the result of the vendor related functions.
func Vendor ¶
func Vendor( rootdir string, vendorDir project.Path, modsrc tf.Source, events ProgressEventStream, ) Report
Vendor will vendor the given module and its dependencies inside the provided root dir. The root dir must be an absolute path. The vendor dir must be an absolute path that will be considered as relative to the given rootdir.
Vendored modules will be located at:
- <rootdir>/<vendordir>/<Source.Path>/<Source.Ref>
The whole path inside the vendor dir will be created if it not exists. Vendoring will not download any git submodules.
The remote git module dependencies will also be vendored and each module.source declaration for those dependencies will be rewritten to reference them inside the vendor directory.
An [EventStream] instance may be passed if the caller is interested on live events from what is happening inside the vendoring process. Passing a nil EventStream ignores all events. It is the caller responsibility to close the [EventStream] after the Vendor call returns.
It returns a report of everything vendored and ignored (with a reason).
func VendorAll ¶
func VendorAll( rootdir string, vendorDir project.Path, tfdir string, events ProgressEventStream, ) Report
VendorAll will vendor all dependencies of the tfdir into rootdir. It will scan all .tf files in the directory and vendor each module declaration containing the supported remote source URLs.
func (Report) HasFailures ¶
HasFailures returns true if any vendor attempt failed. It will exclude all ErrAlreadyVendored since those indicate that the module exists on the vendor dir.
func (*Report) RemoveIgnoredByKind ¶
RemoveIgnoredByKind removes all ignored from this report that have errors with the given kind.