func sh(name string, args ...string) (string, error) {
	cmd := exec.Command(name, args...)
	if isDebugEnabled() {
		log.Printf("DEBUG: sh CMD: %q", cmd)
	}
	out, err := cmd.Output()
	return strings.Trim(string(out), " \n"), err
}
sh is a simple os.exec Command tool, returns trimmed string output
package main
import (
	"bufio"
	"bytes"
	"fmt"
	"log"
	"os/exec"
	"os/user"
	"strconv"
	"strings"
	"time"
)
var (
	defaultShellTimeout = 2 * 60 * time.Second
)
func currentGid() int {
	gid := 0
	current, err := user.Current()
	if err != nil {
		return 0
	}
	gid, err = strconv.Atoi(current.Gid)
	if err != nil {
		return 0
	}
	return gid
}