github.com/HashDataInc/packer@v1.3.2/helper/useragent/useragent.go (about)

     1  package useragent
     2  
     3  import (
     4  	"fmt"
     5  	"runtime"
     6  
     7  	"github.com/hashicorp/packer/version"
     8  )
     9  
    10  var (
    11  	// projectURL is the project URL.
    12  	projectURL = "https://www.packer.io/"
    13  
    14  	// rt is the runtime - variable for tests.
    15  	rt = runtime.Version()
    16  
    17  	// goos is the os - variable for tests.
    18  	goos = runtime.GOOS
    19  
    20  	// goarch is the architecture - variable for tests.
    21  	goarch = runtime.GOARCH
    22  
    23  	// versionFunc is the func that returns the current version. This is a
    24  	// function to take into account the different build processes and distinguish
    25  	// between enterprise and oss builds.
    26  	versionFunc = func() string {
    27  		return version.FormattedVersion()
    28  	}
    29  )
    30  
    31  // String returns the consistent user-agent string for Packer.
    32  func String() string {
    33  	return fmt.Sprintf("Packer/%s (+%s; %s; %s/%s)",
    34  		versionFunc(), projectURL, rt, goos, goarch)
    35  }