github.com/bingoohuang/pkger@v0.0.0-20210127185155-a71b9df4c4c7/apply.go (about)

     1  package pkger
     2  
     3  import (
     4  	"github.com/bingoohuang/pkger/pkging"
     5  )
     6  
     7  // Apply will wrap the current implementation
     8  // of pkger.Pkger with the new pkg. This allows
     9  // for layering of pkging.Pkger implementations.
    10  func Apply(pkg pkging.Pkger, err error) error {
    11  	if err != nil {
    12  		panic(err)
    13  		return err
    14  	}
    15  	gil.Lock()
    16  	defer gil.Unlock()
    17  	current = pkging.Wrap(current, pkg)
    18  	return nil
    19  }