2018-04-04 22:24:21 -04:00
|
|
|
package useragent
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"runtime"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
// projectURL is the project URL.
|
|
|
|
projectURL = "https://www.packer.io/"
|
|
|
|
|
|
|
|
// rt is the runtime - variable for tests.
|
|
|
|
rt = runtime.Version()
|
|
|
|
|
2018-04-05 14:25:11 -04:00
|
|
|
// goos is the os - variable for tests.
|
|
|
|
goos = runtime.GOOS
|
|
|
|
|
|
|
|
// goarch is the architecture - variable for tests.
|
|
|
|
goarch = runtime.GOARCH
|
2018-04-04 22:24:21 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
// String returns the consistent user-agent string for Packer.
|
2020-11-09 20:09:32 -05:00
|
|
|
func String(packerVersion string) string {
|
2018-04-05 14:25:11 -04:00
|
|
|
return fmt.Sprintf("Packer/%s (+%s; %s; %s/%s)",
|
2020-11-09 20:09:32 -05:00
|
|
|
packerVersion, projectURL, rt, goos, goarch)
|
2018-04-04 22:24:21 -04:00
|
|
|
}
|