Migrate to go1.12 to simplify our cmd/http package (#7302)

Simplify the cmd/http package overall by removing
custom plain text v/s tls connection detection, by
migrating to go1.12 and choose minimum version
to be go1.12

Also remove all the vendored deps, since they
are not useful anymore.
This commit is contained in:
Harshavardhana
2019-04-02 18:28:39 -07:00
committed by kannappanr
parent 4c23e6fa55
commit 313a3a286a
2392 changed files with 540 additions and 683347 deletions

37
main.go
View File

@@ -1,3 +1,5 @@
// +build go1.12
/*
* Minio Cloud Storage, (C) 2016, 2017, 2018 Minio, Inc.
*
@@ -23,49 +25,14 @@
package main // import "github.com/minio/minio"
import (
"fmt"
"os"
"runtime"
version "github.com/hashicorp/go-version"
"github.com/minio/mc/pkg/console"
minio "github.com/minio/minio/cmd"
// Import gateway
_ "github.com/minio/minio/cmd/gateway"
)
const (
// Minio requires at least Go v1.9.4
minGoVersion = "1.9.4"
goVersionConstraint = ">= " + minGoVersion
)
// Check if this binary is compiled with at least minimum Go version.
func checkGoVersion(goVersionStr string) error {
constraint, err := version.NewConstraint(goVersionConstraint)
if err != nil {
return fmt.Errorf("'%s': %s", goVersionConstraint, err)
}
goVersion, err := version.NewVersion(goVersionStr)
if err != nil {
return err
}
if !constraint.Check(goVersion) {
return fmt.Errorf("Minio is not compiled by go %s. Minimum required version is %s, go %s release is known to have security issues. Please recompile accordingly", goVersionConstraint, minGoVersion, runtime.Version()[2:])
}
return nil
}
func main() {
// When `go get` is used minimum Go version check is not triggered but it would have compiled it successfully.
// However such binary will fail at runtime, hence we also check Go version at runtime.
if err := checkGoVersion(runtime.Version()[2:]); err != nil {
console.Errorln(err)
}
minio.Main(os.Args)
}