Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
encoding/protobuf: fix linter issues
Browse files Browse the repository at this point in the history
Change-Id: I3c434b7e7b1213d91404044b6bffae36d0b7bcbe
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2725
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
  • Loading branch information
mpvl committed Aug 6, 2019
1 parent 9501233 commit afd1cc5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
10 changes: 1 addition & 9 deletions encoding/protobuf/parse.go
Expand Up @@ -187,13 +187,6 @@ type mapping struct {
pkg *protoConverter
}

type pkgInfo struct {
importPath string // the import path
goPath string // The Go import path
shortName string // Used for the cue package path, default is base of goPath
protoName string // the protobuf package name
}

func (p *protoConverter) toCUEPos(pos scanner.Position) token.Pos {
return p.tfile.Pos(pos.Offset, 0)
}
Expand Down Expand Up @@ -277,8 +270,7 @@ func (p *protoConverter) resolve(pos scanner.Position, name string, options []*p
}
for i := len(p.scope) - 1; i > 0; i-- {
if m, ok := p.scope[i][name]; ok {
cueName := m.ref
cueName = strings.Replace(m.ref, ".", "_", -1)
cueName := strings.Replace(m.ref, ".", "_", -1)
return cueName
}
}
Expand Down
1 change: 0 additions & 1 deletion encoding/protobuf/protobuf.go
Expand Up @@ -116,7 +116,6 @@ type Extractor struct {
paths []string

fileCache map[string]result
instCache map[string]*build.Instance
imports map[string]*build.Instance

errs errors.Error
Expand Down
10 changes: 5 additions & 5 deletions encoding/protobuf/protobuf_test.go
Expand Up @@ -56,7 +56,7 @@ func TestExtractDefinitions(t *testing.T) {

wantFile := filepath.Join("testdata", filepath.Base(file)+".out.cue")
if *update {
ioutil.WriteFile(wantFile, out.Bytes(), 0644)
_ = ioutil.WriteFile(wantFile, out.Bytes(), 0644)
return
}

Expand Down Expand Up @@ -85,10 +85,10 @@ func TestBuild(t *testing.T) {
}

b := NewExtractor(c)
b.AddFile("networking/v1alpha3/gateway.proto", nil)
b.AddFile("mixer/v1/attributes.proto", nil)
b.AddFile("mixer/v1/mixer.proto", nil)
b.AddFile("mixer/v1/config/client/client_config.proto", nil)
_ = b.AddFile("networking/v1alpha3/gateway.proto", nil)
_ = b.AddFile("mixer/v1/attributes.proto", nil)
_ = b.AddFile("mixer/v1/mixer.proto", nil)
_ = b.AddFile("mixer/v1/config/client/client_config.proto", nil)

files, err := b.Files()
if err != nil {
Expand Down

0 comments on commit afd1cc5

Please sign in to comment.