| 
									
										
										
										
											2016-09-01 18:50:31 +08:00
										 |  |  | /* | 
					
						
							| 
									
										
										
										
											2017-02-11 17:27:27 +08:00
										 |  |  |  * Minio Cloud Storage, (C) 2016,2017 Minio, Inc. | 
					
						
							| 
									
										
										
										
											2016-09-01 18:50:31 +08:00
										 |  |  |  * | 
					
						
							|  |  |  |  * 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. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-17 08:23:32 +08:00
										 |  |  | /* | 
					
						
							|  |  |  |  * Below main package has canonical imports for 'go get' and 'go build' | 
					
						
							|  |  |  |  * to work with all other clones of github.com/minio/minio repository. For | 
					
						
							|  |  |  |  * more information refer https://golang.org/doc/go1.4#canonicalimports
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-05 09:25:30 +08:00
										 |  |  | package main // import "github.com/minio/minio"
 | 
					
						
							| 
									
										
										
										
											2015-01-15 03:29:04 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-27 07:22:41 +08:00
										 |  |  | import ( | 
					
						
							| 
									
										
										
										
											2017-02-11 17:27:27 +08:00
										 |  |  | 	"fmt" | 
					
						
							| 
									
										
										
										
											2017-01-27 07:22:41 +08:00
										 |  |  | 	"os" | 
					
						
							| 
									
										
										
										
											2017-02-11 17:27:27 +08:00
										 |  |  | 	"runtime" | 
					
						
							| 
									
										
										
										
											2017-01-27 07:22:41 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-11 17:27:27 +08:00
										 |  |  | 	version "github.com/hashicorp/go-version" | 
					
						
							|  |  |  | 	"github.com/minio/mc/pkg/console" | 
					
						
							| 
									
										
										
										
											2017-01-27 07:22:41 +08:00
										 |  |  | 	minio "github.com/minio/minio/cmd" | 
					
						
							| 
									
										
										
										
											2017-12-06 09:58:09 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// Import gateway
 | 
					
						
							|  |  |  | 	_ "github.com/minio/minio/cmd/gateway" | 
					
						
							| 
									
										
										
										
											2017-01-27 07:22:41 +08:00
										 |  |  | ) | 
					
						
							| 
									
										
										
										
											2015-12-07 06:31:20 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-11 17:27:27 +08:00
										 |  |  | const ( | 
					
						
							| 
									
										
										
										
											2018-02-08 17:03:22 +08:00
										 |  |  | 	// Minio requires at least Go v1.9.4
 | 
					
						
							|  |  |  | 	minGoVersion        = "1.9.4" | 
					
						
							| 
									
										
										
										
											2017-02-11 17:27:27 +08:00
										 |  |  | 	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) { | 
					
						
							| 
									
										
										
										
											2017-08-07 02:27:33 +08:00
										 |  |  | 		return fmt.Errorf("Minio is not compiled by Go %s.  Please recompile accordingly", | 
					
						
							| 
									
										
										
										
											2017-02-11 17:27:27 +08:00
										 |  |  | 			goVersionConstraint) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return nil | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-21 04:05:47 +08:00
										 |  |  | func main() { | 
					
						
							| 
									
										
										
										
											2017-02-11 17:27:27 +08:00
										 |  |  | 	// 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.Fatalln("Go runtime version check failed.", err) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-07 11:35:26 +08:00
										 |  |  | 	minio.Main(os.Args) | 
					
						
							| 
									
										
										
										
											2015-01-15 03:29:04 +08:00
										 |  |  | } |