code.oscarkilo.com/klex-git/util/committest/main.go

..
main.go
package main

// This is a binary that is used inside the ../commit_test.go unit test.
// It is meant to be executed from inside of a post-commit script.
// It prints the CommitInfo object returned by GetCommitInfo(), as JSON.
//
// Running this outside of a Git hook will not print anything useful
// because this binary isn't meant to run in this Git repo. It's meant
// for the temporary Git repo created by ../commit_test.go.

import (
  "encoding/json"
  "fmt"
  "os"

  "oscarkilo.com/klex-git/util"
)

func main() {
  info, err := util.GetCommitInfo()
  if err != nil {
    fmt.Printf("Error in GetCommitInfo(): %v", err)
    return
  }
  json.NewEncoder(os.Stdout).Encode(info)
}