2019-09-21 19:51:29 +03:00
|
|
|
package pkger
|
|
|
|
|
|
|
|
import (
|
2019-09-22 00:38:03 +03:00
|
|
|
"log"
|
|
|
|
"os"
|
2019-09-21 19:51:29 +03:00
|
|
|
"sync"
|
|
|
|
|
|
|
|
"github.com/markbates/pkger/pkging"
|
2019-09-22 00:38:03 +03:00
|
|
|
"github.com/markbates/pkger/pkging/pkgutil"
|
2019-09-21 19:51:29 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
var current pkging.Pkger
|
|
|
|
var gil = &sync.RWMutex{}
|
|
|
|
|
|
|
|
func Apply(pkg pkging.Pkger, err error) error {
|
2019-09-22 00:38:03 +03:00
|
|
|
if err := pkgutil.Dump(os.Stdout, pkg); err != nil {
|
|
|
|
log.Fatal(err)
|
2019-09-21 19:51:29 +03:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
gil.Lock()
|
|
|
|
defer gil.Unlock()
|
|
|
|
current = pkging.Wrap(current, pkg)
|
|
|
|
return nil
|
|
|
|
}
|