| 1 |
package main |
| 2 |
|
| 3 |
import ( |
| 4 |
"flag" |
| 5 |
"fmt" |
| 6 |
"os" |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
_ "github.com/mesos/mesos-go/api/v0/auth" |
| 12 |
_ "github.com/mesos/mesos-go/api/v0/auth/callback" |
| 13 |
_ "github.com/mesos/mesos-go/api/v0/auth/sasl" |
| 14 |
_ "github.com/mesos/mesos-go/api/v0/auth/sasl/mech" |
| 15 |
_ "github.com/mesos/mesos-go/api/v0/auth/sasl/mech/crammd5" |
| 16 |
_ "github.com/mesos/mesos-go/api/v0/detector" |
| 17 |
_ "github.com/mesos/mesos-go/api/v0/detector/zoo" |
| 18 |
_ "github.com/mesos/mesos-go/api/v0/executor" |
| 19 |
_ "github.com/mesos/mesos-go/api/v0/healthchecker" |
| 20 |
_ "github.com/mesos/mesos-go/api/v0/mesosproto" |
| 21 |
_ "github.com/mesos/mesos-go/api/v0/mesosproto/scheduler" |
| 22 |
_ "github.com/mesos/mesos-go/api/v0/mesosutil" |
| 23 |
_ "github.com/mesos/mesos-go/api/v0/mesosutil/process" |
| 24 |
_ "github.com/mesos/mesos-go/api/v0/messenger" |
| 25 |
_ "github.com/mesos/mesos-go/api/v0/messenger/sessionid" |
| 26 |
_ "github.com/mesos/mesos-go/api/v0/scheduler" |
| 27 |
_ "github.com/mesos/mesos-go/api/v0/upid" |
| 28 |
) |
| 29 |
|
| 30 |
|
| 31 |
var allowedFlags = []string{ |
| 32 |
|
| 33 |
"logtostderr", |
| 34 |
"alsologtostderr", |
| 35 |
"v", |
| 36 |
"stderrthreshold", |
| 37 |
"vmodule", |
| 38 |
"log_backtrace_at", |
| 39 |
"log_dir", |
| 40 |
} |
| 41 |
|
| 42 |
func main() { |
| 43 |
expected := map[string]struct{}{} |
| 44 |
for _, f := range allowedFlags { |
| 45 |
expected[f] = struct{}{} |
| 46 |
} |
| 47 |
|
| 48 |
hasLeak := false |
| 49 |
flag.CommandLine.VisitAll(func(f *flag.Flag) { |
| 50 |
if _, ok := expected[f.Name]; !ok { |
| 51 |
fmt.Fprintf(os.Stderr, "Leaking flag %q: %q\n", f.Name, f.Usage) |
| 52 |
hasLeak = true |
| 53 |
} |
| 54 |
}) |
| 55 |
|
| 56 |
if hasLeak { |
| 57 |
os.Exit(1) |
| 58 |
} |
| 59 |
} |