commit 4f2b1608b4dd61f85f4eda3dd2492a2d27fc9558 Author: Jesse Duffield Date: Sun May 13 13:23:45 2018 +1000 initial commit diff --git a/hello-world.go b/hello-world.go new file mode 100644 index 000000000..4cc31296e --- /dev/null +++ b/hello-world.go @@ -0,0 +1,31 @@ +// Go has various value types including strings, +// integers, floats, booleans, etc. Here are a few +// basic examples. + +package main + +import ( + "fmt" + // "log" + "os/exec" + "os" +) + +func main() { + + var ( + cmdOut []byte + err error + ) + cmdName := "git" + cmdArgs := []string{"rev-parse", "--verify", "HEAD"} + if cmdOut, err = exec.Command(cmdName, cmdArgs...).Output(); err != nil { + fmt.Fprintln(os.Stderr, "There was an error running git rev-parse command: ", err) + fmt.Println(string(cmdOut)) + os.Exit(1) + } + sha := string(cmdOut) + firstSix := sha[:6] + fmt.Println("The first six chars of the SHA at HEAD in this repo are", firstSix) + +}