Skip to content

Instantly share code, notes, and snippets.

@mrosset
Created October 21, 2017 20:24
Show Gist options
  • Save mrosset/6390dcfde9aeeb6863bbfaa4cd07b154 to your computer and use it in GitHub Desktop.
Save mrosset/6390dcfde9aeeb6863bbfaa4cd07b154 to your computer and use it in GitHub Desktop.
func HashOnly(path Path) (string, error) {
node, err := core.NewNode(context.TODO(), &core.BuildCfg{NilRepo: true})
if err != nil {
return "", err
}
fd, err := os.Open(path.String())
if err != nil {
return "", err
}
defer fd.Close()
return coreunix.Add(node, fd)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment