You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2018/10/29 10:49:21 UTC

[incubator-servicecomb-service-center] branch master updated: SCB-991 Optimize args parsing (#471)

This is an automated email from the ASF dual-hosted git repository.

littlecui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-service-center.git


The following commit(s) were added to refs/heads/master by this push:
     new 5a68ede  SCB-991 Optimize args parsing (#471)
5a68ede is described below

commit 5a68edee4c4095367145fbe9484b369d30064c9e
Author: little-cui <su...@qq.com>
AuthorDate: Mon Oct 29 18:49:15 2018 +0800

    SCB-991 Optimize args parsing (#471)
    
    * SCB-991 Optimize args parsing
    
    * Optimize core
---
 server/core/core.go | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/server/core/core.go b/server/core/core.go
index 545ceb7..fd31321 100644
--- a/server/core/core.go
+++ b/server/core/core.go
@@ -19,7 +19,8 @@ package core
 
 import (
 	"flag"
-	"github.com/apache/incubator-servicecomb-service-center/pkg/grace"
+	// import the grace package and parse grace cmd line
+	_ "github.com/apache/incubator-servicecomb-service-center/pkg/grace"
 	"github.com/apache/incubator-servicecomb-service-center/pkg/log"
 	"github.com/apache/incubator-servicecomb-service-center/version"
 	"os"
@@ -41,16 +42,12 @@ func Initialize() {
 func ParseCommandLine() {
 	var printVer bool
 	flag.BoolVar(&printVer, "v", false, "Print the version and exit.")
-	flag.CommandLine.Init(os.Args[0], flag.ContinueOnError)
-	flag.CommandLine.Parse(os.Args[1:])
+	flag.Parse()
 
 	if printVer {
 		version.Ver().Print()
 		os.Exit(0)
 	}
-
-	// import the grace package and parse grace cmd line
-	grace.ParseCommandLine()
 }
 
 func handleSignals() {