Fix indentation and skip leading v on the semver.

This commit is contained in:
Erik McClenney 2017-09-28 10:11:30 -07:00
parent b6f23b1eed
commit 7221fe6dd4

View File

@ -305,7 +305,7 @@ func generateCloudConfig(configFile *ConfigFile) (cloudConfig *CloudConfig, err
func CreateGCECloud(config *CloudConfig) (*GCECloud, error) { func CreateGCECloud(config *CloudConfig) (*GCECloud, error) {
// Remove any pre-release version and build metadata from the semver, leaving only the MAJOR.MINOR.PATCH portion. // Remove any pre-release version and build metadata from the semver, leaving only the MAJOR.MINOR.PATCH portion.
// See http://semver.org/. // See http://semver.org/.
version := strings.Split(strings.Split(version.Get().GitVersion, "-")[0], "+")[0] version := strings.TrimLeft(strings.Split(strings.Split(version.Get().GitVersion, "-")[0], "+")[0], "v")
// Create a user-agent header append string to supply to the Google API clients, to identify Kubernetes as the origin of the GCP API calls. // Create a user-agent header append string to supply to the Google API clients, to identify Kubernetes as the origin of the GCP API calls.
userAgent := fmt.Sprintf("(%s %s) Kubernetes/%s", runtime.GOOS, runtime.GOARCH, version) userAgent := fmt.Sprintf("(%s %s) Kubernetes/%s", runtime.GOOS, runtime.GOARCH, version)