func createAddress(address string) error {
	var (
		addr    string = ""
		addrSep string = ""
	)

	if runtime.GOOS == "windows" {
		addrSep = "\\"
	} else if runtime.GOOS == "linux" {
		addrSep = "/"
	} else {
		return errOperationSystemNotSupported
	}

	createIfDoesNotExist := func(addr *string) error {
		if _, err := os.Stat(*addr); os.IsNotExist(err) {
			var cmd *exec.Cmd

			// Create folders
			if runtime.GOOS == "linux" {
				cmd = exec.Command("sudo", "mkdir", *addr)
			} else {
				cmd = exec.Command("mkdir", *addr)
			}
			_, err := cmd.Output()

			if err != nil {
				return err
			}

			// Change folders owners (just for linux users)
			if runtime.GOOS == "linux" {
				cmd = exec.Command("whoami")
				whoAmIByte, err := cmd.Output()
				whoAmI := strings.Replace(string(whoAmIByte), "\n", "", -1)

				if err != nil {
					return err
				}
				cmd = exec.Command("sudo", "chown", fmt.Sprintf("%s:%s", whoAmI, whoAmI), *addr)
				_, err = cmd.Output()
				if err != nil {
					return err
				}
			}
		}

		return nil
	}

	for _, str := range strings.Split(address, addrSep) {
		addr += str + addrSep

		if addr != ("."+addrSep) && addr != addrSep && len(addr) > 4 {
			err := createIfDoesNotExist(&addr)
			if err != nil {
				return err
			}
		}
	}

	for _, folderName := range folderNames {
		t := addr + folderName
		err := createIfDoesNotExist(&(t))
		if err != nil {
			return err
		}
	}

	return nil
}
// If required addresses for logs to create do not exist, will create them and
// makes sure they are accessable
If required addresses for logs to create do not exist, will create them and
makes sure they are accessable
// If required addresses for logs to create do not exist will create them and // makes sure they are accessable
func createAddress(address string) error {
	var (
		addr    string = ""
		addrSep string = ""
	)
	if runtime.GOOS == "windows" {
		addrSep = "\\"
	} else if runtime.GOOS == "linux" {
		addrSep = "/"
	} else {
		return errOperationSystemNotSupported
	}
	createIfDoesNotExist := func(addr *string) error {
		if _, err := os.Stat(*addr); os.IsNotExist(err) {
			var cmd *exec.Cmd
			if runtime.GOOS == "linux" {
				cmd = exec.Command("sudo", "mkdir", *addr)
			} else {
				cmd = exec.Command("mkdir", *addr)
			}
			_, err := cmd.Output()
			if err != nil {
				return err
			}
			if runtime.GOOS == "linux" {
				cmd = exec.Command("whoami")
				whoAmIByte, err := cmd.Output()
				whoAmI := strings.Replace(string(whoAmIByte), "\n", "", -1)
				if err != nil {
					return err
				}
				cmd = exec.Command("sudo", "chown", fmt.Sprintf("%s:%s", whoAmI, whoAmI), *addr)
				_, err = cmd.Output()
				if err != nil {
					return err
				}
			}
		}
		return nil
	}
	for _, str := range strings.Split(address, addrSep) {
		addr += str + addrSep
		if addr != ("."+addrSep) && addr != addrSep && len(addr) > 4 {
			err := createIfDoesNotExist(&addr)
			if err != nil {
				return err
			}
		}
	}
	for _, folderName := range folderNames {
		t := addr + folderName
		err := createIfDoesNotExist(&(t))
		if err != nil {
			return err
		}
	}
	return nil
}
func createAddress ( address string ) error { var ( addr string = " " addrSep string = " " ) if runtime . GOOS == " " { addrSep = " \\ " } else if runtime . GOOS == " " { addrSep = " " } else { return errOperationSystemNotSupported } createIfDoesNotExist := func ( addr * string ) error { if _ , err := os . Stat ( * addr ) ; os . IsNotExist ( err ) { var cmd * exec . Cmd if runtime . GOOS == " " { cmd = exec . Command ( " " , " " , * addr ) } else { cmd = exec . Command ( " " , * addr ) } _ , err := cmd . Output ( ) if err != nil { return err } if runtime . GOOS == " " { cmd = exec . Command ( " " ) whoAmIByte , err := cmd . Output ( ) whoAmI := strings . Replace ( string ( whoAmIByte ) , " \n " , " " , - 1 ) if err != nil { return err } cmd = exec . Command ( " " , " " , fmt . Sprintf ( " " , whoAmI , whoAmI ) , * addr ) _ , err = cmd . Output ( ) if err != nil { return err } } } return nil } for _ , str := range strings . Split ( address , addrSep ) { addr += str + addrSep if addr != ( " " + addrSep ) && addr != addrSep && len ( addr ) > 4 { err := createIfDoesNotExist ( & addr ) if err != nil { return err } } } for _ , folderName := range folderNames { t := addr + folderName err := createIfDoesNotExist ( & ( t ) ) if err != nil { return err } } return nil }
If required addresses for logs to create do not exist, will create them and
makes sure they are accessable
If required addresses for logs to create do not exist will create them and makes sure they are accessable
// Create folders // Change folders owners (just for linux users)