mc: Fix release build flags after recent refactor. (#1794)
This commit is contained in:
@@ -26,8 +26,8 @@ vet:
|
||||
@GO15VENDOREXPERIMENT=1 go tool vet -shadow=true ./pkg
|
||||
|
||||
spelling:
|
||||
@GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/misspell *.go
|
||||
@GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/misspell command/**/*
|
||||
@GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/misspell *
|
||||
@GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/misspell command/*
|
||||
@GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/misspell pkg/**/*
|
||||
|
||||
fmt:
|
||||
@@ -38,12 +38,11 @@ fmt:
|
||||
lint:
|
||||
@echo "Running $@:"
|
||||
@GO15VENDOREXPERIMENT=1 $(GOPATH)/bin/golint .
|
||||
@GO15VENDOREXPERIMENT=1 $(GOPATH)/bin/golint github.com/minio/mc/command
|
||||
@GO15VENDOREXPERIMENT=1 $(GOPATH)/bin/golint github.com/minio/mc/command...
|
||||
@GO15VENDOREXPERIMENT=1 $(GOPATH)/bin/golint github.com/minio/mc/pkg...
|
||||
|
||||
cyclo:
|
||||
@echo "Running $@:"
|
||||
@GO15VENDOREXPERIMENT=1 $(GOPATH)/bin/gocyclo -over 40 *.go
|
||||
@GO15VENDOREXPERIMENT=1 $(GOPATH)/bin/gocyclo -over 40 command
|
||||
@GO15VENDOREXPERIMENT=1 $(GOPATH)/bin/gocyclo -over 40 pkg
|
||||
|
||||
@@ -56,18 +55,13 @@ build: getdeps verifiers
|
||||
|
||||
test: getdeps verifiers
|
||||
@echo "Running all testing:"
|
||||
@GO15VENDOREXPERIMENT=1 go test $(GOFLAGS) ./
|
||||
@GO15VENDOREXPERIMENT=1 go test $(GOFLAGS) github.com/minio/mc/command
|
||||
@GO15VENDOREXPERIMENT=1 go test $(GOFLAGS) github.com/minio/mc/command...
|
||||
@GO15VENDOREXPERIMENT=1 go test $(GOFLAGS) github.com/minio/mc/pkg...
|
||||
|
||||
gomake-all: build
|
||||
@GO15VENDOREXPERIMENT=1 go build --ldflags "$(LDFLAGS)" -o $(GOPATH)/bin/mc
|
||||
@mkdir -p $(HOME)/.mc
|
||||
|
||||
coverage:
|
||||
@GO15VENDOREXPERIMENT=1 go test -race -coverprofile=cover.out ./
|
||||
@go tool cover -html=cover.out && echo "Visit your browser"
|
||||
|
||||
|
||||
pkg-validate-arg-%: ;
|
||||
ifndef PKG
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// +build ignore
|
||||
|
||||
/*
|
||||
* Mc Client (C) 2014, 2015 Mc, Inc.
|
||||
* Mc Client (C) 2014, 2015, 2016 Minio, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,10 +28,10 @@ import (
|
||||
|
||||
func genLDFlags(version string) string {
|
||||
var ldflagsStr string
|
||||
ldflagsStr = "-X main.mcVersion=" + version + " "
|
||||
ldflagsStr = ldflagsStr + "-X main.mcReleaseTag=" + releaseTag(version) + " "
|
||||
ldflagsStr = ldflagsStr + "-X main.mcCommitID=" + commitID() + " "
|
||||
ldflagsStr = ldflagsStr + "-X main.mcShortCommitID=" + commitID()[:12]
|
||||
ldflagsStr = "-X github.com/minio/mc/command.MCVersion=" + version + " "
|
||||
ldflagsStr = ldflagsStr + "-X github.com/minio/mc/command.MCReleaseTag=" + releaseTag(version) + " "
|
||||
ldflagsStr = ldflagsStr + "-X github.com/minio/mc/command.MCCommitID=" + commitID() + " "
|
||||
ldflagsStr = ldflagsStr + "-X github.com/minio/mc/command.MCShortCommitID=" + commitID()[:12]
|
||||
return ldflagsStr
|
||||
}
|
||||
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
package command
|
||||
|
||||
var (
|
||||
// mcVersion - version time.RFC3339.
|
||||
mcVersion = "DEVELOPMENT.GOGET"
|
||||
// mcReleaseTag - release tag in TAG.%Y-%m-%dT%H-%M-%SZ.
|
||||
mcReleaseTag = "DEVELOPMENT.GOGET"
|
||||
// mcCommitID - latest commit id.
|
||||
mcCommitID = "DEVELOPMENT.GOGET"
|
||||
// mcShortCommitID - first 12 characters from mcCommitID.
|
||||
mcShortCommitID = mcCommitID[:12]
|
||||
// MCVersion - version time.RFC3339.
|
||||
MCVersion = "DEVELOPMENT.GOGET"
|
||||
// MCReleaseTag - release tag in TAG.%Y-%m-%dT%H-%M-%SZ.
|
||||
MCReleaseTag = "DEVELOPMENT.GOGET"
|
||||
// MCCommitID - latest commit id.
|
||||
MCCommitID = "DEVELOPMENT.GOGET"
|
||||
// MCShortCommitID - first 12 characters from MCCommitID.
|
||||
MCShortCommitID = MCCommitID[:12]
|
||||
)
|
||||
|
||||
@@ -155,11 +155,10 @@ func newClientFromAlias(alias string, urlStr string) (Client, *probe.Error) {
|
||||
|
||||
s3Config.Signature = hostCfg.API
|
||||
s3Config.AppName = "mc"
|
||||
s3Config.AppVersion = mcVersion
|
||||
s3Config.AppVersion = MCVersion
|
||||
s3Config.AppComments = []string{os.Args[0], runtime.GOOS, runtime.GOARCH}
|
||||
s3Config.HostURL = urlStr
|
||||
s3Config.Debug = globalDebug
|
||||
|
||||
s3Client, err := s3New(s3Config)
|
||||
if err != nil {
|
||||
return nil, err.Trace(alias, urlStr)
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// This package contains all the global variables and constants. ONLY TO BE ACCESSED VIA GET/SET FUNCTIONS.
|
||||
// Package command contains all the global variables and constants. ONLY TO BE ACCESSED VIA GET/SET FUNCTIONS.
|
||||
package command
|
||||
|
||||
import (
|
||||
|
||||
+3
-3
@@ -56,7 +56,7 @@ GLOBAL FLAGS:
|
||||
{{range .Flags}}{{.}}
|
||||
{{end}}{{end}}
|
||||
VERSION:
|
||||
` + mcVersion +
|
||||
` + MCVersion +
|
||||
`{{ "\n"}}{{range $key, $value := ExtraInfo}}
|
||||
{{$key}}:
|
||||
{{$value}}
|
||||
@@ -76,8 +76,8 @@ func Main() {
|
||||
}
|
||||
|
||||
probe.Init() // Set project's root source path.
|
||||
probe.SetAppInfo("Release-Tag", mcReleaseTag)
|
||||
probe.SetAppInfo("Commit", mcShortCommitID)
|
||||
probe.SetAppInfo("Release-Tag", MCReleaseTag)
|
||||
probe.SetAppInfo("Commit", MCShortCommitID)
|
||||
|
||||
app := registerApp()
|
||||
app.Before = registerBefore
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Minio Client, (C) 2015 Minio, Inc.
|
||||
* Minio Client, (C) 2015, 2016 Minio, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Session V2 - Version 2 stores session header and session data in
|
||||
// Package command - session V7 - Version 7 stores session header and session data in
|
||||
// two separate files. Session data contains fully prepared URL list.
|
||||
package command
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Minio Client (C) 2014, 2015 Minio, Inc.
|
||||
* Minio Client (C) 2014, 2015, 2016 Minio, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// This file implements a simple trie tree to be used for 'mc' cli commands.
|
||||
// Package command - This file implements a simple trie tree to be used for 'mc' cli commands.
|
||||
package command
|
||||
|
||||
// This package borrows idea from - https://godoc.org/golang.org/x/text/internal/triegen.
|
||||
|
||||
@@ -164,12 +164,12 @@ func getReleaseUpdate(updateURL string) {
|
||||
data, e := client.Get(newUpdateURL)
|
||||
fatalIf(probe.NewError(e), "Unable to read from update URL ‘"+newUpdateURL+"’.")
|
||||
|
||||
if strings.HasPrefix(mcVersion, "DEVELOPMENT.GOGET") {
|
||||
if strings.HasPrefix(MCVersion, "DEVELOPMENT.GOGET") {
|
||||
fatalIf(errDummy().Trace(newUpdateURL),
|
||||
"Update mechanism is not supported for ‘go get’ based binary builds. Please download official releases from https://minio.io/#minio")
|
||||
}
|
||||
|
||||
current, e := time.Parse(time.RFC3339, mcVersion)
|
||||
current, e := time.Parse(time.RFC3339, MCVersion)
|
||||
fatalIf(probe.NewError(e), "Unable to parse version string as time.")
|
||||
|
||||
if current.IsZero() {
|
||||
@@ -190,7 +190,7 @@ func getReleaseUpdate(updateURL string) {
|
||||
|
||||
updateMsg := updateMessage{
|
||||
Download: downloadURL,
|
||||
Version: mcVersion,
|
||||
Version: MCVersion,
|
||||
}
|
||||
if latest.After(current) {
|
||||
updateMsg.Update = true
|
||||
|
||||
@@ -89,9 +89,9 @@ func mainVersion(ctx *cli.Context) {
|
||||
console.SetColor("CommitID", color.New(color.FgGreen))
|
||||
|
||||
verMsg := versionMessage{}
|
||||
verMsg.CommitID = mcCommitID
|
||||
verMsg.ReleaseTag = mcReleaseTag
|
||||
verMsg.Version.Value = mcVersion
|
||||
verMsg.CommitID = MCCommitID
|
||||
verMsg.ReleaseTag = MCReleaseTag
|
||||
verMsg.Version.Value = MCVersion
|
||||
verMsg.Version.Format = "RFC3339"
|
||||
|
||||
printMsg(verMsg)
|
||||
|
||||
@@ -24,6 +24,6 @@ import (
|
||||
)
|
||||
|
||||
func (s *TestSuite) TestVersion(c *C) {
|
||||
_, e := time.Parse(mcVersion, http.TimeFormat)
|
||||
_, e := time.Parse(MCVersion, http.TimeFormat)
|
||||
c.Assert(e, NotNil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user