OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package main | 5 package main |
6 | 6 |
7 import ( | 7 import ( |
8 "errors" | 8 "errors" |
9 "os" | 9 "os" |
| 10 "runtime" |
10 | 11 |
11 "github.com/luci/luci-go/client/internal/common" | 12 "github.com/luci/luci-go/client/internal/common" |
12 "github.com/luci/luci-go/client/internal/lhttp" | 13 "github.com/luci/luci-go/client/internal/lhttp" |
13 "github.com/maruel/subcommands" | 14 "github.com/maruel/subcommands" |
14 ) | 15 ) |
15 | 16 |
| 17 func init() { |
| 18 runtime.GOMAXPROCS(runtime.NumCPU()) |
| 19 } |
| 20 |
16 type commonFlags struct { | 21 type commonFlags struct { |
17 subcommands.CommandRunBase | 22 subcommands.CommandRunBase |
18 defaultFlags common.Flags | 23 defaultFlags common.Flags |
19 serverURL string | 24 serverURL string |
20 } | 25 } |
21 | 26 |
22 // Init initializes common flags. | 27 // Init initializes common flags. |
23 func (c *commonFlags) Init() { | 28 func (c *commonFlags) Init() { |
24 c.defaultFlags.Init(&c.Flags) | 29 c.defaultFlags.Init(&c.Flags) |
25 c.Flags.StringVar(&c.serverURL, "server", os.Getenv("SWARMING_SERVER"),
"Server URL; required. Set $SWARMING_SERVER to set a default.") | 30 c.Flags.StringVar(&c.serverURL, "server", os.Getenv("SWARMING_SERVER"),
"Server URL; required. Set $SWARMING_SERVER to set a default.") |
(...skipping 11 matching lines...) Expand all Loading... |
37 if err != nil { | 42 if err != nil { |
38 return err | 43 return err |
39 } | 44 } |
40 c.serverURL = s | 45 c.serverURL = s |
41 return nil | 46 return nil |
42 } | 47 } |
43 | 48 |
44 func (c *commonFlags) Close() error { | 49 func (c *commonFlags) Close() error { |
45 return c.defaultFlags.Close() | 50 return c.defaultFlags.Close() |
46 } | 51 } |
OLD | NEW |