Skip to content

Instantly share code, notes, and snippets.

@sbenthall
Created November 10, 2016 23:11
Show Gist options
  • Save sbenthall/003d682114c08de1ddc8bbb9a7ab2c7c to your computer and use it in GitHub Desktop.
Save sbenthall/003d682114c08de1ddc8bbb9a7ab2c7c to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/core"
)
func main() {
r, _ := git.NewFilesystemRepository(".git")
_ = r.Clone(&git.CloneOptions{URL: "https://github.com/git-fixtures/tags"})
refs, _ := r.Refs()
refs.ForEach(func(ref *core.Reference) error {
if !ref.IsTag() {
fmt.Println(ref)
return nil
} else {
fmt.Println("tags ->", ref)
return nil
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment