// NewFromDirectoryWithName creates a new source object tailored to catalog a given filesystem directory recursively, with an explicitly provided name.
288
-
func NewFromDirectoryWithName(path string, name string) (Source, error) {
295
+
// NewFromDirectoryWithNameVersion creates a new source object tailored to catalog a given filesystem directory recursively, with an explicitly provided name.
// NewFromDirectoryRootWithName creates a new source object tailored to catalog a given filesystem directory recursively, with an explicitly provided name.
303
317
func NewFromDirectoryRootWithName(path string, name string) (Source, error) {
// NewFromDirectoryRootWithNameVersion creates a new source object tailored to catalog a given filesystem directory recursively, with an explicitly provided name.
322
+
func NewFromDirectoryRootWithNameVersion(path string, name string, version string) (Source, error) {
304
323
s := Source{
305
324
mutex: &sync.Mutex{},
306
325
Metadata: Metadata{
307
-
Name: name,
308
-
Scheme: DirectoryScheme,
309
-
Path: path,
310
-
Base: path,
326
+
Name: name,
327
+
Version: version,
328
+
Scheme: DirectoryScheme,
329
+
Path: path,
330
+
Base: path,
311
331
},
312
332
path: path,
313
333
base: path,
skipped 9 lines
323
343
324
344
// NewFromFileWithName creates a new source object tailored to catalog a file, with an explicitly provided name.
325
345
func NewFromFileWithName(path string, name string) (Source, func()) {
346
+
return NewFromFileWithNameVersion(path, name, "")
347
+
}
348
+
349
+
// NewFromFileWithNameVersion creates a new source object tailored to catalog a file, with an explicitly provided name and version.
350
+
func NewFromFileWithNameVersion(path string, name string, version string) (Source, func()) {
326
351
analysisPath, cleanupFn := fileAnalysisPath(path)
327
352
328
353
s := Source{
329
354
mutex: &sync.Mutex{},
330
355
Metadata: Metadata{
331
-
Name: name,
332
-
Scheme: FileScheme,
333
-
Path: path,
356
+
Name: name,
357
+
Version: version,
358
+
Scheme: FileScheme,
359
+
Path: path,
334
360
},
335
361
path: analysisPath,
336
362
}
skipped 43 lines
380
406
// NewFromImageWithName creates a new source object tailored to catalog a given container image, relative to the
381
407
// option given (e.g. all-layers, squashed, etc), with an explicit name.
382
408
func NewFromImageWithName(img *image.Image, userImageStr string, name string) (Source, error) {