etcdmain: support grpc-proxy/gateway compiled with -tags cov

This commit is contained in:
Anthony Romano 2017-07-20 10:44:14 -07:00
parent 5c6a6bdc5a
commit 7c22d35dff

View File

@ -17,6 +17,7 @@ package etcdmain
import (
"fmt"
"os"
"strings"
"github.com/coreos/go-systemd/daemon"
systemdutil "github.com/coreos/go-systemd/util"
@ -26,7 +27,13 @@ func Main() {
checkSupportArch()
if len(os.Args) > 1 {
switch os.Args[1] {
cmd := os.Args[1]
if covArgs := os.Getenv("ETCDCOV_ARGS"); len(covArgs) > 0 {
args := strings.Split(os.Getenv("ETCDCOV_ARGS"), "\xe7\xcd")[1:]
rootCmd.SetArgs(args)
cmd = "grpc-proxy"
}
switch cmd {
case "gateway", "grpc-proxy":
if err := rootCmd.Execute(); err != nil {
fmt.Fprint(os.Stderr, err)