github.com/cloud-foundations/dominator@v0.0.0-20221004181915-6e4fee580046/cmd/imagetool/computedFiles.go (about)

     1  package main
     2  
     3  import (
     4  	"errors"
     5  
     6  	"github.com/Cloud-Foundations/Dominator/lib/filesystem"
     7  	"github.com/Cloud-Foundations/Dominator/lib/filesystem/util"
     8  )
     9  
    10  type computedFileType struct {
    11  	Filename string
    12  	Source   string
    13  }
    14  
    15  func spliceComputedFiles(fs *filesystem.FileSystem) error {
    16  	if *computedFiles == "" {
    17  		return nil
    18  	}
    19  	cfl, err := util.LoadComputedFiles(*computedFiles)
    20  	if err != nil {
    21  		return errors.New("cannot load computed files: " + err.Error())
    22  	}
    23  	if err := util.SpliceComputedFiles(fs, cfl); err != nil {
    24  		return errors.New("cannot splice computed files: " + err.Error())
    25  	}
    26  	return nil
    27  }