util.go 425 B

1234567891011121314151617181920212223242526
  1. package apigen
  2. import (
  3. "os/exec"
  4. "strings"
  5. )
  6. func getGitName() string {
  7. cmd := exec.Command("git", "config", "user.name")
  8. out, err := cmd.CombinedOutput()
  9. if err != nil {
  10. return ""
  11. }
  12. return strings.TrimSpace(string(out))
  13. }
  14. func getGitEmail() string {
  15. cmd := exec.Command("git", "config", "user.email")
  16. out, err := cmd.CombinedOutput()
  17. if err != nil {
  18. return ""
  19. }
  20. return strings.TrimSpace(string(out))
  21. }