MCPcopy Index your code
hub / github.com/cloudquery/cloudquery / initialize

Method initialize

cli/internal/specs/v0/spec_reader.go:365–389  ·  view source on GitHub ↗
(paths []string)

Source from the content-addressed store, hash-verified

363}
364
365func (r *SpecReader) initialize(paths []string) error {
366 for _, path := range paths {
367 file, err := os.Open(path)
368 if err != nil {
369 return err
370 }
371 fileInfo, err := file.Stat()
372 if err != nil {
373 file.Close()
374 return err
375 }
376 file.Close()
377 if fileInfo.IsDir() {
378 if err := r.loadSpecsFromDir(path); err != nil {
379 return err
380 }
381 } else {
382 if err := r.loadSpecsFromFile(path); err != nil {
383 return err
384 }
385 }
386 }
387
388 return nil
389}
390
391// strip yaml comments from the given yaml document by converting to JSON and back :)
392func stripYamlComments(b []byte) ([]byte, error) {

Callers 3

NewSpecReaderFunction · 0.80
NewRelaxedSpecReaderFunction · 0.80

Calls 3

loadSpecsFromDirMethod · 0.95
loadSpecsFromFileMethod · 0.95
CloseMethod · 0.65

Tested by

no test coverage detected