From 0cdcd66f67051ce22e1da426429925fb3b824a71 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Fri, 13 Apr 2018 12:19:16 -0400 Subject: [PATCH] Use standard user-agent header (#1332) This PR does a few things to the User-Agent header: 1. It puts Terraform/(version) first, since that's the way the RFC expects it 2. It removes the goos and goarch data, although I could be convinced to put it back in, I don't see what value it's providing 3. Moves directly to consuming the version package (which is the comment above the function previously being called) --- google/config.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/google/config.go b/google/config.go index ccf0e0d9d00..6f8113c13da 100644 --- a/google/config.go +++ b/google/config.go @@ -6,12 +6,11 @@ import ( "fmt" "log" "net/http" - "runtime" "strings" "github.com/hashicorp/terraform/helper/logging" "github.com/hashicorp/terraform/helper/pathorcontents" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform/version" "golang.org/x/oauth2" "golang.org/x/oauth2/google" @@ -141,9 +140,9 @@ func (c *Config) loadAndValidate() error { client.Transport = logging.NewTransport("Google", client.Transport) - versionString := terraform.VersionString() - userAgent := fmt.Sprintf( - "(%s %s) Terraform/%s", runtime.GOOS, runtime.GOARCH, versionString) + projectURL := "https://www.terraform.io" + userAgent := fmt.Sprintf("Terraform/%s (+%s)", + version.String(), projectURL) c.client = client c.userAgent = userAgent