diff --git a/cmd/readmevalidation/main.go b/cmd/readmevalidation/main.go index b4f108d2..b4c393ed 100644 --- a/cmd/readmevalidation/main.go +++ b/cmd/readmevalidation/main.go @@ -125,11 +125,25 @@ func main() { return } activeBranchName := head.Name().Short() - _, err = repo.Reference(plumbing.ReferenceName(activeBranchName), true) + fmt.Println("Found ", activeBranchName) + + wt, err := repo.Worktree() if err != nil { errChan <- err return } + err = wt.Checkout(&git.CheckoutOptions{ + Branch: plumbing.ReferenceName(activeBranchName), + Create: false, + Force: false, + Keep: true, + }) + if err != nil { + errChan <- err + return + } + + fmt.Println("Got here!") }() // Validate templates @@ -142,10 +156,14 @@ func main() { wg.Wait() close(errChan) <-doneChan + if len(readmeValidationErrors) == 0 { + log.Println("All validation was successful") + return + } + + fmt.Println("---\nEncountered the following problems") for _, err := range readmeValidationErrors { log.Println(err) } - if len(readmeValidationErrors) != 0 { - os.Exit(1) - } + os.Exit(1) } diff --git a/cmd/readmevalidation/repoStructure.go b/cmd/readmevalidation/repoStructure.go index 328f5a0f..732a2a40 100644 --- a/cmd/readmevalidation/repoStructure.go +++ b/cmd/readmevalidation/repoStructure.go @@ -93,8 +93,8 @@ func validateRepoStructure() error { problems = append(problems, err) } - // Todo: figure out what other directories and decide what other invariants - // we want to set for them + // Todo: figure out what other directories we want to make guarantees for + // and add them to this function if len(problems) != 0 { return validationPhaseError{ phase: validationPhaseFileStructureValidation,