Ejemplo n.º 1
0
// checkCommentLocation verifies that the given location exists at the given commit.
func checkCommentLocation(repo repository.Repo, commit, file string, line uint) error {
	contents, err := repo.Show(commit, file)
	if err != nil {
		return err
	}
	lines := strings.Split(contents, "\n")
	if line > uint(len(lines)) {
		return fmt.Errorf("Line number %d does not exist in file %q", line, file)
	}
	return nil
}