github.com/goplusjs/gopherjs@v1.2.6-0.20211206034512-f187917453b8/internal/goversion/version.go (about)

     1  package goversion
     2  
     3  import (
     4  	"go/build"
     5  	"strconv"
     6  
     7  	"github.com/visualfc/goversion"
     8  )
     9  
    10  func ReleaseTags() []string {
    11  	if installReleaseTags == nil {
    12  		return build.Default.ReleaseTags
    13  	}
    14  	return installReleaseTags
    15  }
    16  
    17  var (
    18  	installReleaseTags []string
    19  )
    20  
    21  func buildReleaseTags(version int) (tags []string) {
    22  	for i := 1; i <= version; i++ {
    23  		tags = append(tags, "go1."+strconv.Itoa(i))
    24  	}
    25  	return
    26  }
    27  
    28  func init() {
    29  	ver, verinfo, ok := goversion.Installed()
    30  	if ok && ver.Major == 1 {
    31  		installReleaseTags = buildReleaseTags(ver.Minor)
    32  	} else {
    33  		installReleaseTags = build.Default.ReleaseTags
    34  	}
    35  	Version = verinfo
    36  }
    37  
    38  var (
    39  	Version string
    40  )