- cloneRepo := "https://github.com/iotbzh/helloworld-service.git"
- cloneDir := path.Join(os.Getenv(envRootCfgDir), "testExec")
- t.Logf("Cloning repo %v in %v\n...\n", cloneRepo, cloneDir)
- var cloneOptions git.CloneOptions
- repository, err := git.Clone(cloneRepo, cloneDir, &cloneOptions)
- if err != nil {
- t.Fatal(err)
- }
-
- repository.Submodules.Foreach(func(sub *git.Submodule, name string) int {
- sub.Init(true)
- err := sub.Update(true, &git.SubmoduleUpdateOptions{
- &git.CheckoutOpts{
- Strategy: git.CheckoutForce | git.CheckoutUpdateSubmodules,
- },
- &git.FetchOptions{},
- })
- if err != nil {
- log.Fatal(err)
- }
- return 0
-
- })
-
- t.Logf("repo cloned\n")