func Get() (string, error) {
	data, err := readFileFromKoData(commitIDFile)
	if err != nil {
		return "", err
	}
	commitID := strings.TrimSpace(string(data))
	if !commitIDRE.MatchString(commitID) {
		err := fmt.Errorf("%q is not a valid GitHub commit ID", commitID)
		return "", err
	}
	return string(commitID[0:7]), nil
}
Get tries to fetch the first 7 digitals of GitHub commit ID from HEAD file in
KO_DATA_PATH. If it fails, it returns the error it gets.
package changeset
import (
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"regexp"
	"strings"
)
const (
	commitIDFile      = "HEAD"
	koDataPathEnvName = "KO_DATA_PATH"
)
var (
	commitIDRE = regexp.MustCompile(`^[a-f0-9]{40}$`)
)