Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: client/cmd/swarming/common.go

Issue 1159563002: Move retry and lhttp packages from client/internal to common/. (Closed) Base URL: git@github.com:luci/luci-go@master
Patch Set: move-retry-http Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « client/cmd/isolated/common.go ('k') | client/internal/lhttp/client.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
11 » "github.com/luci/luci-go/client/internal/lhttp" 11 » "github.com/luci/luci-go/common/lhttp"
12 "github.com/maruel/subcommands" 12 "github.com/maruel/subcommands"
13 ) 13 )
14 14
15 type commonFlags struct { 15 type commonFlags struct {
16 subcommands.CommandRunBase 16 subcommands.CommandRunBase
17 serverURL string 17 serverURL string
18 verbose bool 18 verbose bool
19 } 19 }
20 20
21 // Init initializes common flags. 21 // Init initializes common flags.
22 func (c *commonFlags) Init() { 22 func (c *commonFlags) Init() {
23 c.Flags.StringVar(&c.serverURL, "server", os.Getenv("SWARMING_SERVER"), "Server URL; required. Set $SWARMING_SERVER to set a default.") 23 c.Flags.StringVar(&c.serverURL, "server", os.Getenv("SWARMING_SERVER"), "Server URL; required. Set $SWARMING_SERVER to set a default.")
24 c.Flags.BoolVar(&c.verbose, "verbose", false, "Enable logging.") 24 c.Flags.BoolVar(&c.verbose, "verbose", false, "Enable logging.")
25 } 25 }
26 26
27 // Parse parses the common flags. 27 // Parse parses the common flags.
28 func (c *commonFlags) Parse(a subcommands.Application) error { 28 func (c *commonFlags) Parse(a subcommands.Application) error {
29 if c.serverURL == "" { 29 if c.serverURL == "" {
30 return errors.New("must provide -server") 30 return errors.New("must provide -server")
31 } 31 }
32 s, err := lhttp.URLToHTTPS(c.serverURL) 32 s, err := lhttp.URLToHTTPS(c.serverURL)
33 if err != nil { 33 if err != nil {
34 return err 34 return err
35 } 35 }
36 c.serverURL = s 36 c.serverURL = s
37 return nil 37 return nil
38 } 38 }
OLDNEW
« no previous file with comments | « client/cmd/isolated/common.go ('k') | client/internal/lhttp/client.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698