server: Move all the top level files into cmd folder. (#2490)

This change brings a change which was done for the 'mc'
package to allow for clean repo and have a cleaner
github drop in experience.
master
Harshavardhana 8 years ago committed by Anand Babu (AB) Periasamy
parent 73d1a46f3e
commit bccf549463
  1. 16
      Makefile
  2. 2
      appveyor.yml
  3. 10
      buildscripts/gen-ldflags.go
  4. 2
      cmd/access-key.go
  5. 2
      cmd/api-datatypes.go
  6. 2
      cmd/api-errors.go
  7. 4
      cmd/api-headers.go
  8. 2
      cmd/api-headers_test.go
  9. 2
      cmd/api-resources.go
  10. 4
      cmd/api-response-multipart.go
  11. 2
      cmd/api-response.go
  12. 2
      cmd/api-router.go
  13. 2
      cmd/auth-handler.go
  14. 2
      cmd/auth-handler_test.go
  15. 2
      cmd/benchmark-utils_test.go
  16. 2
      cmd/bucket-handlers-listobjects.go
  17. 2
      cmd/bucket-handlers.go
  18. 2
      cmd/bucket-notification-datatypes.go
  19. 2
      cmd/bucket-notification-handlers.go
  20. 2
      cmd/bucket-notification-handlers_test.go
  21. 2
      cmd/bucket-notification-utils.go
  22. 2
      cmd/bucket-notification-utils_test.go
  23. 2
      cmd/bucket-policy-handlers.go
  24. 2
      cmd/bucket-policy-handlers_test.go
  25. 2
      cmd/bucket-policy-migrate.go
  26. 4
      cmd/bucket-policy-parser.go
  27. 2
      cmd/bucket-policy-parser_test.go
  28. 2
      cmd/bucket-policy.go
  29. 24
      cmd/build-constants.go
  30. 2
      cmd/certs.go
  31. 2
      cmd/certs_test.go
  32. 2
      cmd/checkport.go
  33. 2
      cmd/checkport_test.go
  34. 2
      cmd/commands.go
  35. 2
      cmd/config-migrate.go
  36. 2
      cmd/config-old.go
  37. 2
      cmd/config-v6.go
  38. 2
      cmd/config.go
  39. 2
      cmd/control-main.go
  40. 2
      cmd/crossdomain-xml-handler.go
  41. 2
      cmd/damerau-levenshtein.go
  42. 2
      cmd/damerau-levenshtein_test.go
  43. 2
      cmd/erasure-createfile.go
  44. 2
      cmd/erasure-createfile_test.go
  45. 2
      cmd/erasure-healfile.go
  46. 2
      cmd/erasure-healfile_test.go
  47. 2
      cmd/erasure-readfile.go
  48. 2
      cmd/erasure-readfile_test.go
  49. 2
      cmd/erasure-utils.go
  50. 2
      cmd/erasure-utils_test.go
  51. 2
      cmd/erasure_test.go
  52. 2
      cmd/event-notifier.go
  53. 2
      cmd/event-notifier_test.go
  54. 2
      cmd/faulty-disk_test.go
  55. 2
      cmd/format-config-v1.go
  56. 2
      cmd/format-config-v1_test.go
  57. 2
      cmd/fs-createfile.go
  58. 2
      cmd/fs-v1-errors.go
  59. 4
      cmd/fs-v1-metadata.go
  60. 2
      cmd/fs-v1-metadata_test.go
  61. 2
      cmd/fs-v1-multipart-common.go
  62. 2
      cmd/fs-v1-multipart.go
  63. 2
      cmd/fs-v1.go
  64. 2
      cmd/fs-v1_test.go
  65. 2
      cmd/generic-handlers.go
  66. 2
      cmd/globals.go
  67. 2
      cmd/handler-utils.go
  68. 2
      cmd/handler-utils_test.go
  69. 2
      cmd/host-to-ip.go
  70. 2
      cmd/host-to-ip_test.go
  71. 2
      cmd/httprange.go
  72. 2
      cmd/httprange_test.go
  73. 2
      cmd/leak-detect_test.go
  74. 2
      cmd/logger-console-hook.go
  75. 2
      cmd/logger-file-hook.go
  76. 2
      cmd/logger-syslog-hook_nix.go
  77. 2
      cmd/logger-syslog-hook_windows.go
  78. 4
      cmd/logger.go
  79. 2
      cmd/logger_test.go
  80. 193
      cmd/main.go
  81. 2
      cmd/main_test.go
  82. 2
      cmd/namespace-lock.go
  83. 2
      cmd/namespace-lock_test.go
  84. 2
      cmd/notifiers.go
  85. 2
      cmd/notifiers_test.go
  86. 2
      cmd/notify-amqp.go
  87. 2
      cmd/notify-elasticsearch.go
  88. 2
      cmd/notify-redis.go
  89. 2
      cmd/object-api-getobject_test.go
  90. 2
      cmd/object-api-getobjectinfo_test.go
  91. 2
      cmd/object-api-listobjects_test.go
  92. 2
      cmd/object-api-multipart_test.go
  93. 2
      cmd/object-api-putobject_test.go
  94. 2
      cmd/object-common.go
  95. 2
      cmd/object-datatypes.go
  96. 2
      cmd/object-errors.go
  97. 2
      cmd/object-handlers-common.go
  98. 2
      cmd/object-handlers.go
  99. 2
      cmd/object-handlers_test.go
  100. 2
      cmd/object-interface.go
  101. Some files were not shown because too many files have changed in this diff Show More

@ -71,19 +71,19 @@ verifiers: vet fmt lint cyclo spelling
vet:
@echo "Running $@:"
@GO15VENDOREXPERIMENT=1 go tool vet -all *.go
@GO15VENDOREXPERIMENT=1 go tool vet -all ./cmd
@GO15VENDOREXPERIMENT=1 go tool vet -all ./pkg
@GO15VENDOREXPERIMENT=1 go tool vet -shadow=true *.go
@GO15VENDOREXPERIMENT=1 go tool vet -shadow=true ./cmd
@GO15VENDOREXPERIMENT=1 go tool vet -shadow=true ./pkg
fmt:
@echo "Running $@:"
@GO15VENDOREXPERIMENT=1 gofmt -s -l *.go
@GO15VENDOREXPERIMENT=1 gofmt -s -l cmd
@GO15VENDOREXPERIMENT=1 gofmt -s -l pkg
lint:
@echo "Running $@:"
@GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/golint *.go
@GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/golint github.com/minio/minio/cmd...
@GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/golint github.com/minio/minio/pkg...
ineffassign:
@ -92,7 +92,7 @@ ineffassign:
cyclo:
@echo "Running $@:"
@GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/gocyclo -over 65 *.go
@GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/gocyclo -over 65 cmd
@GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/gocyclo -over 65 pkg
build: getdeps verifiers $(UI_ASSETS)
@ -101,12 +101,12 @@ deadcode:
@GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/deadcode
spelling:
@GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/misspell -error *.go
@GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/misspell -error cmd/**/*
@GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/misspell -error pkg/**/*
test: build
@echo "Running all minio testing:"
@GO15VENDOREXPERIMENT=1 go test $(GOFLAGS) .
@GO15VENDOREXPERIMENT=1 go test $(GOFLAGS) github.com/minio/minio/cmd...
@GO15VENDOREXPERIMENT=1 go test $(GOFLAGS) github.com/minio/minio/pkg...
coverage: build
@ -139,8 +139,6 @@ experimental: verifiers
clean:
@echo "Cleaning up all the generated files:"
@rm -fv minio minio.test cover.out
@find . -name '*.test' | xargs rm -fv
@rm -rf isa-l
@rm -rf build
@rm -rf release

@ -22,7 +22,7 @@ install:
# to run your custom scripts instead of automatic MSBuild
build_script:
- go test -race .
- go test -race github.com/minio/minio/cmd...
- go test -race github.com/minio/minio/pkg...
- go test -coverprofile=coverage.txt -covermode=atomic
- go run buildscripts/gen-ldflags.go > temp.txt

@ -28,11 +28,11 @@ import (
func genLDFlags(version string) string {
var ldflagsStr string
ldflagsStr = "-X main.minioVersion=" + version
ldflagsStr += " -X main.minioReleaseTag=" + releaseTag(version)
ldflagsStr += " -X main.minioCommitID=" + commitID()
ldflagsStr += " -X main.minioShortCommitID=" + commitID()[:12]
ldflagsStr += " -X main.minioGOPATH=" + os.Getenv("GOPATH")
ldflagsStr = "-X github.com/minio/minio/cmd.Version=" + version
ldflagsStr += " -X github.com/minio/minio/cmd.ReleaseTag=" + releaseTag(version)
ldflagsStr += " -X github.com/minio/minio/cmd.CommitID=" + commitID()
ldflagsStr += " -X github.com/minio/minio/cmd.ShortCommitID=" + commitID()[:12]
ldflagsStr += " -X github.com/minio/minio/cmd.GOPATH=" + os.Getenv("GOPATH")
return ldflagsStr
}

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"crypto/rand"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"encoding/xml"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"encoding/xml"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"
@ -44,7 +44,7 @@ func generateRequestID() []byte {
func setCommonHeaders(w http.ResponseWriter) {
// Set unique request ID for each reply.
w.Header().Set("X-Amz-Request-Id", string(generateRequestID()))
w.Header().Set("Server", ("Minio/" + minioReleaseTag + " (" + runtime.GOOS + "; " + runtime.GOARCH + ")"))
w.Header().Set("Server", ("Minio/" + ReleaseTag + " (" + runtime.GOOS + "; " + runtime.GOARCH + ")"))
w.Header().Set("Accept-Ranges", "bytes")
}

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"testing"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"net/url"

@ -14,9 +14,9 @@
* limitations under the License.
*/
// File carries any specific responses constructed/necessary in
// Package cmd file carries any specific responses constructed/necessary in
// multipart operations.
package main
package cmd
import "net/http"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"encoding/xml"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import router "github.com/gorilla/mux"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"net/http"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"encoding/xml"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"encoding/xml"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import "strings"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import "testing"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,9 +14,9 @@
* limitations under the License.
*/
// This file implements AWS Access Policy Language parser in
// Package cmd This file implements AWS Access Policy Language parser in
// accordance with http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
package main
package cmd
import (
"encoding/json"

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -1,5 +1,5 @@
/*
* Minio Cloud Storage, (C) 2015 Minio, Inc.
* Minio Cloud Storage, (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,20 +14,20 @@
* limitations under the License.
*/
package main
package cmd
// DO NOT EDIT THIS FILE DIRECTLY. These are build-time constants
// set through ‘buildscripts/gen-ldflags.go’.
var (
// minioGOPATH - GOPATH value at the time of build.
minioGOPATH = ""
// GOPATH - GOPATH value at the time of build.
GOPATH = ""
// minioVersion - version time.RFC3339.
minioVersion = "DEVELOPMENT.GOGET"
// minioReleaseTag - release tag in TAG.%Y-%m-%dT%H-%M-%SZ.
minioReleaseTag = "DEVELOPMENT.GOGET"
// minioCommitID - latest commit id.
minioCommitID = "DEVELOPMENT.GOGET"
// minioShortCommitID - first 12 characters from minioCommitID.
minioShortCommitID = minioCommitID[:12]
// Version - version time.RFC3339.
Version = "DEVELOPMENT.GOGET"
// ReleaseTag - release tag in TAG.%Y-%m-%dT%H-%M-%SZ.
ReleaseTag = "DEVELOPMENT.GOGET"
// CommitID - latest commit id.
CommitID = "DEVELOPMENT.GOGET"
// ShortCommitID - first 12 characters from CommitID.
ShortCommitID = CommitID[:12]
)

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"os"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"os"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"fmt"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"fmt"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import "github.com/minio/cli"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"errors"

@ -1,4 +1,4 @@
package main
package cmd
import (
"os"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"os"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"os"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"fmt"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import "net/http"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"math"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"math"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"encoding/hex"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import "encoding/hex"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"encoding/hex"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import "testing"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
// Simulates disk returning errFaultyDisk on all methods of StorageAPI
// interface after successCount number of successes.

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"encoding/json"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import "io"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import "errors"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"encoding/json"
@ -98,7 +98,7 @@ func newFSMetaV1() (fsMeta fsMetaV1) {
fsMeta = fsMetaV1{}
fsMeta.Version = "1.0.0"
fsMeta.Format = "fs"
fsMeta.Minio.Release = minioReleaseTag
fsMeta.Minio.Release = ReleaseTag
return fsMeta
}

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"os"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"encoding/json"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"crypto/md5"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"crypto/md5"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"os"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"net/http"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"github.com/fatih/color"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"io"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"net"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import "testing"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"fmt"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import "testing"

@ -5,7 +5,7 @@
// Package leaktest provides tools to detect leaked goroutines in tests.
// To use it, call "defer leaktest.AfterTest(t)()" at the beginning of each
// test that may use goroutines.
package main
package cmd
import (
"runtime"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"io/ioutil"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"fmt"

@ -16,7 +16,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"fmt"

@ -16,7 +16,7 @@
* limitations under the License.
*/
package main
package cmd
type syslogLogger struct {
Enable bool `json:"enable"`

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bufio"
@ -56,7 +56,7 @@ func stackInfo() string {
stackBuf.ReadFrom(rawStack)
// Strip GOPATH of the build system and return.
return strings.Replace(stackBuf.String(), minioGOPATH+"/src/", "", -1)
return strings.Replace(stackBuf.String(), GOPATH+"/src/", "", -1)
}
// errorIf synonymous with fatalIf but doesn't exit on error != nil

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -0,0 +1,193 @@
/*
* Minio Cloud Storage, (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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cmd
import (
"fmt"
"os"
"sort"
"github.com/minio/cli"
"github.com/minio/mc/pkg/console"
"github.com/pkg/profile"
)
var (
// global flags for minio.
minioFlags = []cli.Flag{
cli.BoolFlag{
Name: "help, h",
Usage: "Show help.",
},
}
)
// Help template for minio.
var minioHelpTemplate = `NAME:
{{.Name}} - {{.Usage}}
DESCRIPTION:
{{.Description}}
USAGE:
minio {{if .Flags}}[flags] {{end}}command{{if .Flags}}{{end}} [arguments...]
COMMANDS:
{{range .Commands}}{{join .Names ", "}}{{ "\t" }}{{.Usage}}
{{end}}{{if .Flags}}
FLAGS:
{{range .Flags}}{{.}}
{{end}}{{end}}
VERSION:
` + Version +
`{{ "\n"}}`
// init - check the environment before main starts
func init() {
// Check if minio was compiled using a supported version of Golang.
checkGoVersion()
// Set global trace flag.
globalTrace = os.Getenv("MINIO_TRACE") == "1"
}
func migrate() {
// Migrate config file
migrateConfig()
// Migrate other configs here.
}
func enableLoggers() {
// Enable all loggers here.
enableConsoleLogger()
enableFileLogger()
// Add your logger here.
}
func findClosestCommands(command string) []string {
var closestCommands []string
for _, value := range commandsTree.PrefixMatch(command) {
closestCommands = append(closestCommands, value.(string))
}
sort.Strings(closestCommands)
// Suggest other close commands - allow missed, wrongly added and
// even transposed characters
for _, value := range commandsTree.walk(commandsTree.root) {
if sort.SearchStrings(closestCommands, value.(string)) < len(closestCommands) {
continue
}
// 2 is arbitrary and represents the max
// allowed number of typed errors
if DamerauLevenshteinDistance(command, value.(string)) < 2 {
closestCommands = append(closestCommands, value.(string))
}
}
return closestCommands
}
func registerApp() *cli.App {
// Register all commands.
registerCommand(serverCmd)
registerCommand(versionCmd)
registerCommand(updateCmd)
registerCommand(controlCmd)
// Set up app.
app := cli.NewApp()
app.Name = "Minio"
app.Author = "Minio.io"
app.Usage = "Cloud Storage Server."
app.Description = `Minio is an Amazon S3 compatible object storage server. Use it to store photos, videos, VMs, containers, log files, or any blob of data as objects.`
app.Flags = append(minioFlags, globalFlags...)
app.Commands = commands
app.CustomAppHelpTemplate = minioHelpTemplate
app.CommandNotFound = func(ctx *cli.Context, command string) {
msg := fmt.Sprintf("‘%s’ is not a minio sub-command. See ‘minio --help’.", command)
closestCommands := findClosestCommands(command)
if len(closestCommands) > 0 {
msg += fmt.Sprintf("\n\nDid you mean one of these?\n")
for _, cmd := range closestCommands {
msg += fmt.Sprintf(" ‘%s’\n", cmd)
}
}
console.Fatalln(msg)
}
return app
}
func checkMainSyntax(c *cli.Context) {
configPath, err := getConfigPath()
if err != nil {
console.Fatalf("Unable to obtain user's home directory. \nError: %s\n", err)
}
if configPath == "" {
console.Fatalln("Config folder cannot be empty, please specify --config-dir <foldername>.")
}
}
// Main - main for minio server.
func Main() {
app := registerApp()
app.Before = func(c *cli.Context) error {
// Sets new config folder.
setGlobalConfigPath(c.GlobalString("config-dir"))
// Valid input arguments to main.
checkMainSyntax(c)
// Migrate any old version of config / state files to newer format.
migrate()
// Initialize config.
err := initConfig()
fatalIf(err, "Unable to initialize minio config.")
// Enable all loggers by now.
enableLoggers()
// Set global quiet flag.
globalQuiet = c.Bool("quiet") || c.GlobalBool("quiet")
// Do not print update messages, if quiet flag is set.
if !globalQuiet {
// Do not print any errors in release update function.
noError := true
updateMsg := getReleaseUpdate(minioUpdateStableURL, noError)
if updateMsg.Update {
console.Println(updateMsg)
}
}
return nil
}
// Set ``MINIO_PROFILE_DIR`` to the directory where profiling information should be persisted
profileDir := os.Getenv("MINIO_PROFILE_DIR")
// Enable profiler if ``MINIO_PROFILER`` is set. Supported options are [cpu, mem, block].
switch os.Getenv("MINIO_PROFILER") {
case "cpu":
defer profile.Start(profile.CPUProfile, profile.ProfilePath(profileDir)).Stop()
case "mem":
defer profile.Start(profile.MemProfile, profile.ProfilePath(profileDir)).Stop()
case "block":
defer profile.Start(profile.BlockProfile, profile.ProfilePath(profileDir)).Stop()
}
// Run the app - exit on error.
app.RunAndExitOnError()
}

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"testing"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"errors"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import "testing"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"errors"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import "testing"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"io/ioutil"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"errors"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"io/ioutil"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"path/filepath"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import "time"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"errors"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"net/http"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"encoding/hex"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import (
"bytes"

@ -14,7 +14,7 @@
* limitations under the License.
*/
package main
package cmd
import "io"

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save