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

Side by Side Diff: logdog/client/cmd/logdog_annotee/link.go

Issue 2626433004: Move "common/config" common types into cfgtypes. (Closed)
Patch Set: Created 3 years, 11 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 | « logdog/client/cli/subcommandList.go ('k') | logdog/client/cmd/logdog_annotee/main.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 LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package main 5 package main
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "net/url" 9 "net/url"
10 "strings" 10 "strings"
11 11
12 "github.com/luci/luci-go/common/config"
13 "github.com/luci/luci-go/logdog/common/types" 12 "github.com/luci/luci-go/logdog/common/types"
13 "github.com/luci/luci-go/luci_config/common/cfgtypes"
14 ) 14 )
15 15
16 type coordinatorLinkGenerator struct { 16 type coordinatorLinkGenerator struct {
17 host string 17 host string
18 » project config.ProjectName 18 » project cfgtypes.ProjectName
19 prefix types.StreamName 19 prefix types.StreamName
20 } 20 }
21 21
22 func (g *coordinatorLinkGenerator) canGenerateLinks() bool { 22 func (g *coordinatorLinkGenerator) canGenerateLinks() bool {
23 return (g.host != "" && g.prefix != "") 23 return (g.host != "" && g.prefix != "")
24 } 24 }
25 25
26 func (g *coordinatorLinkGenerator) GetLink(names ...types.StreamName) string { 26 func (g *coordinatorLinkGenerator) GetLink(names ...types.StreamName) string {
27 links := make([]string, len(names)) 27 links := make([]string, len(names))
28 for i, n := range names { 28 for i, n := range names {
29 streamName := string(g.prefix.Join(n)) 29 streamName := string(g.prefix.Join(n))
30 proj := g.project 30 proj := g.project
31 if proj == "" { 31 if proj == "" {
32 proj = "_" 32 proj = "_"
33 } 33 }
34 links[i] = fmt.Sprintf("s=%s", url.QueryEscape(fmt.Sprintf("%s/% s", proj, streamName))) 34 links[i] = fmt.Sprintf("s=%s", url.QueryEscape(fmt.Sprintf("%s/% s", proj, streamName)))
35 } 35 }
36 return fmt.Sprintf("https://%s/v/?%s", g.host, strings.Join(links, "&")) 36 return fmt.Sprintf("https://%s/v/?%s", g.host, strings.Join(links, "&"))
37 } 37 }
OLDNEW
« no previous file with comments | « logdog/client/cli/subcommandList.go ('k') | logdog/client/cmd/logdog_annotee/main.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698