mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-04 03:48:07 +02:00
initial commit
This commit is contained in:
commit
4f2b1608b4
31
hello-world.go
Normal file
31
hello-world.go
Normal file
@ -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)
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user