You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 18, 2019. It is now read-only.
fmt.Fprintf(os.Stderr, "The third argument must be 'comment' or not specified.\n")
os.Exit(1)
}
args = args[:2]
}
if len(args) != 2 {
fmt.Fprintf(os.Stderr, "Expects two arguments, a path to the Godep.json file and a package to get the commit for (and optionally, 'comment' as the third option)\n")
os.Exit(1)
}
path := args[0]
pkg := args[1]
data, err := ioutil.ReadFile(path)
if err != nil {
fmt.Fprintf(os.Stderr, "Unable to read %s: %v\n", path, err)
os.Exit(1)
}
godeps := &Godep{}
if err := json.Unmarshal(data, godeps); err != nil {
fmt.Fprintf(os.Stderr, "Unable to read %s: %v\n", path, err)
os.Exit(1)
}
for _, dep := range godeps.Deps {
if dep.ImportPath != pkg {
continue
}
if len(dep.Rev) > 7 {
dep.Rev = dep.Rev[0:7]
}
if comment && len(dep.Comment) > 0 {
dep.Rev = dep.Comment
}
fmt.Fprintf(os.Stdout, dep.Rev)
return
}
fmt.Fprintf(os.Stderr, "Could not find %s in %s\n", pkg, path)