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

Side by Side Diff: grpc/cmd/cproto/discovery.go

Issue 2219023003: Update APIs to use new Google cloud paths. (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Created 4 years, 4 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
OLDNEW
1 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 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 "bytes" 8 "bytes"
9 "compress/gzip" 9 "compress/gzip"
10 "fmt" 10 "fmt"
11 "io/ioutil" 11 "io/ioutil"
12 "os" 12 "os"
13 "os/exec" 13 "os/exec"
14 "strings" 14 "strings"
15 "text/template" 15 "text/template"
16 16
17 "github.com/golang/protobuf/proto" 17 "github.com/golang/protobuf/proto"
18 "github.com/luci/luci-go/common/proto/google/descriptor"
19 "golang.org/x/net/context" 18 "golang.org/x/net/context"
19 "google.golang.org/genproto/protobuf"
20 ) 20 )
21 21
22 const ( 22 const (
23 discoveryPackagePath = "github.com/luci/luci-go/grpc/discovery" 23 discoveryPackagePath = "github.com/luci/luci-go/grpc/discovery"
24 ) 24 )
25 25
26 // discoveryTmpl is template for generated Go discovery file. 26 // discoveryTmpl is template for generated Go discovery file.
27 // The result of execution will also be passed through gofmt. 27 // The result of execution will also be passed through gofmt.
28 var discoveryTmpl = template.Must(template.New("").Parse(strings.TrimSpace(` 28 var discoveryTmpl = template.Must(template.New("").Parse(strings.TrimSpace(`
29 // AUTOGENERATED. DO NOT EDIT. 29 // AUTOGENERATED. DO NOT EDIT.
30 30
31 package {{.GoPkg}}; 31 package {{.GoPkg}};
32 32
33 {{if .ImportDiscovery}} 33 {{if .ImportDiscovery}}
34 import discovery "github.com/luci/luci-go/grpc/discovery" 34 import discovery "github.com/luci/luci-go/grpc/discovery"
35 {{end}} 35 {{end}}
36 import "github.com/luci/luci-go/common/proto/google/descriptor" 36 import "google.golang.org/genproto/protobuf"
37 37
38 func init() { 38 func init() {
39 {{if .ImportDiscovery}}discovery.{{end}}RegisterDescriptorSetCompressed( 39 {{if .ImportDiscovery}}discovery.{{end}}RegisterDescriptorSetCompressed(
40 []string{ 40 []string{
41 {{range .ServiceNames}}"{{.}}",{{end}} 41 {{range .ServiceNames}}"{{.}}",{{end}}
42 }, 42 },
43 {{.CompressedBytes}}, 43 {{.CompressedBytes}},
44 ) 44 )
45 } 45 }
46 46
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 var buf bytes.Buffer 147 var buf bytes.Buffer
148 w := gzip.NewWriter(&buf) 148 w := gzip.NewWriter(&buf)
149 if _, err := w.Write(data); err != nil { 149 if _, err := w.Write(data); err != nil {
150 return nil, err 150 return nil, err
151 } 151 }
152 if err := w.Close(); err != nil { 152 if err := w.Close(); err != nil {
153 return nil, err 153 return nil, err
154 } 154 }
155 return buf.Bytes(), nil 155 return buf.Bytes(), nil
156 } 156 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698