diff --git a/cmd/globals.go b/cmd/globals.go index 4fff63c48..cc5ecf026 100644 --- a/cmd/globals.go +++ b/cmd/globals.go @@ -25,7 +25,7 @@ import ( // Global constants for Minio. const ( - minGoVersion = ">= 1.7.1" // minimum Go runtime version + minGoVersion = ">= 1.7" // Minio requires at least Go v1.7 ) // minio configuration related constants. diff --git a/cmd/update-main.go b/cmd/update-main.go index f8983aa98..fbf4c317c 100644 --- a/cmd/update-main.go +++ b/cmd/update-main.go @@ -20,7 +20,6 @@ import ( "bytes" "encoding/json" "errors" - "fmt" "io/ioutil" "net/http" "os" @@ -138,8 +137,6 @@ func parseReleaseData(data string) (time.Time, error) { // Minio (OS; ARCH) APP/VER APP/VER var ( userAgentSuffix = "Minio/" + Version + " " + "Minio/" + ReleaseTag + " " + "Minio/" + CommitID - userAgentPrefix = "Minio (" + runtime.GOOS + "; " + runtime.GOARCH + ") " - userAgent = userAgentPrefix + userAgentSuffix ) // Check if the operating system is a docker container. @@ -200,8 +197,15 @@ func getReleaseUpdate(updateURL string, duration time.Duration) (updateMsg updat return } + userAgentPrefix := func() string { + if isDocker() { + return "Minio (" + runtime.GOOS + "; " + runtime.GOARCH + "; " + "docker) " + } + return "Minio (" + runtime.GOOS + "; " + runtime.GOARCH + ") " + }() + // Set user agent. - req.Header.Set("User-Agent", userAgent+" "+fmt.Sprintf("Docker/%t", isDocker())) + req.Header.Set("User-Agent", userAgentPrefix+" "+userAgentSuffix) // Fetch new update. resp, err := client.Do(req) diff --git a/cmd/update-main_nix_test.go b/cmd/update-main_nix_test.go index 885fc5b58..0f4a92726 100644 --- a/cmd/update-main_nix_test.go +++ b/cmd/update-main_nix_test.go @@ -37,8 +37,6 @@ func TestReleaseUpdateVersion(t *testing.T) { fmt.Fprintln(w, "fbe246edbd382902db9a4035df7dce8cb441357d minio.RELEASE.2016-10-07T01-16-39Z") })) userAgentSuffix = "Minio/" + Version + " " + "Minio/" + ReleaseTag + " " + "Minio/" + CommitID - userAgentPrefix = "Minio (" + runtime.GOOS + "; " + runtime.GOARCH + ") " - userAgent = userAgentPrefix + userAgentSuffix defer ts.Close() testCases := []struct { updateURL string diff --git a/cmd/update-main_windows_test.go b/cmd/update-main_windows_test.go index 32d213af4..7f271be72 100644 --- a/cmd/update-main_windows_test.go +++ b/cmd/update-main_windows_test.go @@ -37,8 +37,6 @@ func TestReleaseUpdateVersion(t *testing.T) { fmt.Fprintln(w, "fbe246edbd382902db9a4035df7dce8cb441357d minio.RELEASE.2016-10-07T01-16-39Z") })) userAgentSuffix = "Minio/" + Version + " " + "Minio/" + ReleaseTag + " " + "Minio/" + CommitID - userAgentPrefix = "Minio (" + runtime.GOOS + "; " + runtime.GOARCH + ") " - userAgent = userAgentPrefix + userAgentSuffix defer ts.Close() testCases := []struct { updateURL string