Unfortunately, you can't run this in the browser here
This program uses exec.Command("git", "log", ...) to read
your local git history, so it must be run locally — it cannot run in the
browser.
Clone the repo and run go run main.go in a directory with
git history.
Description
View the source code
package main
import (
"encoding/json"
"fmt"
"os/exec"
"strings"
)
func main() {
counts := map[string]int{}
cmd :=
exec.Command("git","log","--format=%an|%ad|%s","--date=short")
output, err := cmd.Output()
if err != nil {
fmt.Println("Error executing git log:", err)
return
}
words := strings.Split(string(output), "\n")
for _, word := range words {
if word != "" {
parts := strings.Split(word, "|")
author := parts[0]
counts[author]++
}
}
jsonData,err := json.MarshalIndent(counts,""," ")
if err != nil {
fmt.Println("Error marshalling JSON:", err)
return
}
fmt.Println(counts)
}
Previous Day
Next Day