From 2d1347c1ece7312675abde6c9c273a3fa982649f Mon Sep 17 00:00:00 2001 From: Christopher Boumenot Date: Thu, 5 May 2016 13:10:55 -0700 Subject: [PATCH] Insert Packer's version into the User Agent. (#3465) --- builder/googlecompute/driver_gce.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/builder/googlecompute/driver_gce.go b/builder/googlecompute/driver_gce.go index 7c8e45f02..bea0c4770 100644 --- a/builder/googlecompute/driver_gce.go +++ b/builder/googlecompute/driver_gce.go @@ -8,6 +8,7 @@ import ( "time" "github.com/mitchellh/packer/packer" + "github.com/mitchellh/packer/version" "golang.org/x/oauth2" "golang.org/x/oauth2/google" @@ -68,12 +69,7 @@ func NewDriverGCE(ui packer.Ui, p string, a *accountFile) (Driver, error) { log.Printf("[INFO] Instantiating GCE client...") service, err := compute.New(client) // Set UserAgent - versionString := "0.0.0" - // TODO(dcunnin): Use Packer's version code from version.go - // versionString := main.Version - // if main.VersionPrerelease != "" { - // versionString = fmt.Sprintf("%s-%s", versionString, main.VersionPrerelease) - // } + versionString := version.FormattedVersion() service.UserAgent = fmt.Sprintf( "(%s %s) Packer/%s", runtime.GOOS, runtime.GOARCH, versionString)