func Exit(rc int) {
	cleanup()
	os.Exit(rc)
}
Exit with the given return code, gracefully cleaning up
package utils
import (
	"bytes"
	"crypto/md5"
	"encoding/gob"
	"errors"
	"fmt"
	"github.com/howeyc/gopass"
	color "github.com/mgutz/ansi"
	"io"
	"net/url"
	"os"
	"os/exec"
	"runtime"
	"strings"
	"time"
)
var (
	Purple = color.ColorFunc("magenta+h")
	Red    = color.ColorFunc("red+h")
	Blue   = color.ColorFunc("blue+h")
	Bold   = color.ColorFunc("default+b")
)
func MinMax(array []float64) (float64, float64, error) {
	if len(array) == 0 {
		return 0, 0, errors.New("no min/max of empty array")
	}
	var max = array[0]
	var min = array[0]
	for _, value := range array {
		if max < value {
			max = value
		}
		if min > value {
			min = value
		}
	}
	return min, max, nil
}
func RemoveOneValue(slice []float64, value float64) []float64 {
	for index, arrValue := range slice {
		if arrValue == value {
			return append(slice[:index], slice[index+1:]...)
		}
	}
	return slice
}
func VisualLength(str string) int {
	inEscapeSeq := false
	length := 0
	for _, r := range str {
		switch {
		case inEscapeSeq:
			if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') {
				inEscapeSeq = false
			}
		case r == '\x1b':
			inEscapeSeq = true
		default:
			length++
		}
	}
	return length
}
func TrimToVisualLength(message string, length int) string {
	for VisualLength(message) > length && len(message) > 1 {
		message = message[:len(message)-1]
	}
	return message
}
func ExitWithErrorMessage(msg string) {
	cleanup()
	fmt.Fprintln(os.Stderr, Red(msg))
	os.Exit(1)
}