Skip to content

Commit

Permalink
fixed issue8
Browse files Browse the repository at this point in the history
  • Loading branch information
awalterschulze committed Mar 28, 2014
1 parent 2395ecf commit 969c126
Show file tree
Hide file tree
Showing 10 changed files with 390 additions and 37 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ regenerate:
make -C test/enumstringer regenerate
make -C test/unmarshalmerge regenerate
make -C test/moredefaults regenerate
make -C test/issue8 regenerate
gofmt -l -s -w .

tests:
Expand All @@ -86,6 +87,7 @@ tests:
go test -v ./test/enumstringer
go test -v ./test/unmarshalmerge
go test -v ./test/moredefaults
go test -v ./test/issue8
make -C protoc-gen-gogo/testdata test

testall:
Expand All @@ -102,6 +104,7 @@ testall:
go test -v ./test/enumstringer
go test -v ./test/unmarshalmerge
go test -v ./test/moredefaults
go test -v ./test/issue8
make -C protoc-gen-gogo/testdata test
go test -v ./test/mixmatch

Expand Down
4 changes: 2 additions & 2 deletions plugin/unmarshal/unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
if packed {
p.P(`if wireType != `, strconv.Itoa(proto.WireBytes), `{`)
p.In()
p.P(`return proto.ErrWrongType`)
p.P(`return ` + protoPkg.Use() + `.ErrWrongType`)
p.Out()
p.P(`}`)
p.P(`var packedLen int`)
Expand All @@ -299,7 +299,7 @@ func (p *unmarshal) Generate(file *generator.FileDescriptor) {
} else {
p.P(`if wireType != `, strconv.Itoa(wireType), `{`)
p.In()
p.P(`return proto.ErrWrongType`)
p.P(`return ` + protoPkg.Use() + `.ErrWrongType`)
p.Out()
p.P(`}`)
}
Expand Down
14 changes: 7 additions & 7 deletions test/example/example.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions test/issue8/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Extensions for Protocol Buffers to create more go like structures.
#
# Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
# http://code.google.com/p/gogoprotobuf
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

regenerate:
(protoc --proto_path=../../../../../:. --gogo_out=. proto.proto)
218 changes: 218 additions & 0 deletions test/issue8/proto.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions test/issue8/proto.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package proto;

import "code.google.com/p/gogoprotobuf/gogoproto/gogo.proto";

option (gogoproto.unmarshaler_all) = true;
option (gogoproto.testgen_all) = true;
option (gogoproto.populate_all) = true;
option (gogoproto.equal_all) = true;

message Foo {
required uint64 bar = 1;
}
Loading

0 comments on commit 969c126

Please sign in to comment.