func AddExtraSpaceIfExist(str string) string {
	if str != "" {
		return " " + str
	}
	return ""
}
AddExtraSpaceIfExist adds a separator
package util
import (
	"fmt"
	"net"
	"os"
	"reflect"
	"regexp"
	"runtime"
	"strings"
	"time"
	"github.com/bwmarrin/snowflake"
	"github.com/mbndr/figlet4go"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/status"
)
const RFC3339FullDate = "2006-01-02"
func GetCurrentTime() time.Time {
	return time.Now()
}
func GetCurrentTimeString(timeType string) string {
	return GetCurrentTime().Format(timeType)
}
func GetCurrentTimeUnix() int64 {
	return GetCurrentTime().Unix()
}
func CheckFileIsExist(filename string) bool {
	var exist = true
	if _, err := os.Stat(filename); os.IsNotExist(err) {
		exist = false
	}
	return exist
}
func StringInSlice(value string, stringSlice []string) bool {
	for _, v := range stringSlice {
		if v == value {
			return true
		}
	}
	return false
}
func StringContainsInSlice(value string, stringSlice []string) bool {
	for _, v := range stringSlice {
		if strings.Contains(value, v) {
			return true
		}
	}
	return false
}
func SliceInSlice(sliceToCheck []string, slice []string) bool {
	for _, v := range sliceToCheck {
		if !StringInSlice(v, slice) {
			return false
		}
	}
	return true
}
func RecordErrorLevelTwo() (uintptr, string, int) {
	funcName, file, line, _ := runtime.Caller(2)
	return funcName, file, line
}
func Getparentdirectory(path string, level int) string {
	return strings.Join(strings.Split(path, "/")[0:len(strings.Split(path, "/"))-level], "/")
}
func DeleteExtraSpace(s string) string {
	s1 := strings.Replace(s, "	", " ", -1)       
	regstr := "\\s{2,}"                          
	reg, _ := regexp.Compile(regstr)             
	s2 := make([]byte, len(s1))                  
	copy(s2, s1)                                 
	spcIndex := reg.FindStringIndex(string(s2))  
	for len(spcIndex) > 0 {                      
		s2 = append(s2[:spcIndex[0]+1], s2[spcIndex[1]:]...)  
		spcIndex = reg.FindStringIndex(string(s2))            
	}
	return string(s2)
}
func GetTypeName(myvar interface{}, isToLowerCase bool) string {
	name := ""
	t := reflect.TypeOf(myvar)
	if t.Kind() == reflect.Ptr {
		name = t.Elem().Name()
	} else {
		name = t.Name()
	}
	if isToLowerCase {
		name = strings.ToLower(name)
	}
	return name
}
func GenerateSnowFlakeID(nodenumber int64) int64 {
	node, _ := snowflake.NewNode(nodenumber)
	id := node.Generate().Int64()
	return id
}
func GetFreePort() (int, error) {
	addr, err := net.ResolveTCPAddr("tcp", "localhost:0")
	if err != nil {
		return 0, err
	}
	l, err := net.ListenTCP("tcp", addr)
	if err != nil {
		return 0, err
	}
	defer l.Close()
	return l.Addr().(*net.TCPAddr).Port, nil
}
func GetServiceName(projectName string) string {
	return fmt.Sprintf("%v", projectName)
}
func GetServiceID(projectName string, projectVersion string, ServiceIP string, ServicePort int) string {
	ServiceName := GetServiceName(projectName)
	return fmt.Sprintf("%v-%v-%v-%v", ServiceName, projectVersion, ServiceIP, ServicePort)
}