github.com/tonyhb/nomad@v0.11.8/helper/useragent/useragent.go (about)

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