func (v Version) PreRelease() string {
	if v.raw == "" {
		return ""
	}
	return v.preRelease
}
PreRelease returns prerelease version
package version
import (
	"errors"
	"regexp"
	"strconv"
	"strings"
)
type Version struct {
	raw        string
	slice      [3]int
	preRelease string
	build      string
	size       int
}
var (
	ErrEmpty = errors.New("Version can't be empty")
	ErrEmptyBuild = errors.New("Build number is empty")
	ErrEmptyPrerelease = errors.New("Prerelease number is empty")
)
var preRegExp = regexp.MustCompile(`([a-zA-Z-.]{1,})([0-9]{0,})`)
func Parse(v string) (Version, error) {
	if v == "" {
		return Version{}, ErrEmpty
	}
	var slice = [3]int{0, 0, 0}
	var raw = v
	var (
		preRelease string
		build      string
		size       int
	)
	if strings.Contains(v, "+") {
		bs := strings.Split(v, "+")
		if bs[1] == "" {
			return Version{}, ErrEmptyBuild
		}
		v = bs[0]
		build = bs[1]
	}
	if strings.Contains(v, "-") {
		ps := strings.Split(v, "-")
		if ps[1] == "" {
			return Version{}, ErrEmptyPrerelease
		}
		v = ps[0]
		preRelease = ps[1]
	}
	for index, version := range strings.Split(v, ".") {
		if index < 3 {
			iv, err := strconv.Atoi(version)
			if err != nil {
				return Version{}, err
			}
			slice[index] = iv
			size = index + 1
		}
	}
	return Version{
		raw:        raw,
		slice:      slice,
		preRelease: preRelease,
		build:      build,
		size:       size,
	}, nil
}
func (v Version) Major() int {
	if v.raw == "" || len(v.slice) == 0 {
		return -1
	}
	return v.slice[0]
}
func (v Version) Minor() int {
	if v.raw == "" || len(v.slice) == 0 {
		return -1
	}
	return v.slice[1]
}
func (v Version) Patch() int {
	if v.raw == "" || len(v.slice) == 0 {
		return -1
	}
	return v.slice[2]
}