github.com/YousefHaggyHeroku/pack@v1.5.5/internal/registry/git.go (about) 1 package registry 2 3 import ( 4 "bytes" 5 "text/template" 6 7 "github.com/pkg/errors" 8 ) 9 10 // GitCommit commits a Buildpack to a registry Cache. 11 func GitCommit(b Buildpack, username string, registryCache Cache) error { 12 if err := registryCache.Initialize(); err != nil { 13 return err 14 } 15 16 commitTemplate, err := template.New("buildpack").Parse(GitCommitTemplate) 17 if err != nil { 18 return err 19 } 20 21 var commit bytes.Buffer 22 if err := commitTemplate.Execute(&commit, b); err != nil { 23 return errors.Wrap(err, "creating template") 24 } 25 26 if err := registryCache.Commit(b, username, commit.String()); err != nil { 27 return err 28 } 29 30 return nil 31 }