func GetCurrPath() string {
	file, _ := exec.LookPath(os.Args[0])
	path, _ := filepath.Abs(file)
	index := strings.LastIndex(path, string(os.PathSeparator))
	ret := path[:index]
	return ret
}
GetCurrPath get current path string
package main
import (
	"bufio"
	"bytes"
	"encoding/json"
	"fmt"
	"net"
	"os"
	"os/exec"
	"path/filepath"
	"strings"
	"github.com/Sirupsen/logrus"
)
func fatal(err error) {
	logrus.Error(err)
	fmt.Fprintln(os.Stderr, err)
	os.Exit(1)
}
func DeDuplicate(input []string) []string {
	if input == nil {
		return nil
	}
	result := []string{}
	internal := map[string]struct{}{}
	for _, value := range input {
		value = strings.TrimSpace(value)
		if value == "" {
			continue
		}
		if _, exist := internal[value]; !exist {
			internal[value] = struct{}{}
			result = append(result, value)
		}
	}
	return result
}
func isJSON(s string) bool {
	var js map[string]interface{}
	return json.Unmarshal([]byte(s), &js) == nil
}
func jsonPrettyPrint(in string) string {
	var out bytes.Buffer
	err := json.Indent(&out, []byte(in), "", "    ")
	if err != nil {
		return in
	}
	return out.String()
}
func checkURLScheme(addr, scheme string) string {
	var address string
	if strings.HasPrefix(addr, scheme) {
		address = addr
	} else {
		address = fmt.Sprintf("%s://%s", scheme, addr)
	}
	return address
}
func checkIPAddr(iparray []string) error {
	for _, ip := range iparray {
		ip = strings.TrimSpace(ip)
		if ip == "" {
			continue
		}
		i := net.ParseIP(ip)
		if i == nil {
			return fmt.Errorf("%s is invalid ip addr", ip)
		}
	}
	return nil
}