proteus icon indicating copy to clipboard operation
proteus copied to clipboard

Proteus is generating a proto message even when the struct is not marked for generation:

Open aantelov87 opened this issue 8 years ago • 1 comments

the structs are not marked for generation but proteus is generating a proto file with a Address message related to Address type from go code. Check below what I am doing:

package order

type Address struct {
	City    string
	Country string
	Line1   string
	Line2   string
	ZipCode string
	State   string
}

type Shipping struct {
	Address        *Address
	Carrier        string
	FirstName      string
	LastName       string
	Phone          string
	TrackingNumber string
}

Output after proteus execution:

syntax = "proto3";
package example.pkg.order;

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

option (gogoproto.protosizer_all) = true;
option (gogoproto.sizer_all) = false;
option go_package = "order";

message Address {
	option (gogoproto.goproto_getters) = false;
	option (gogoproto.typedecl) = false;
	string city = 1;
	string country = 2;
	string line1 = 3;
	string line2 = 4;
	string zip_code = 5;
	string state = 6;
}

Expected output:

syntax = "proto3";
package example.pkg.order;

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

option (gogoproto.protosizer_all) = true;
option (gogoproto.sizer_all) = false;
option go_package = "order";

I think that is a bug because it is working proper if the Address type is embedded in the Shipping type for example:

package order

type Address struct {
	City    string
	Country string
	Line1   string
	Line2   string
	ZipCode string
	State   string
}

type Shipping struct {
	Address
	Carrier        string
	FirstName      string
	LastName       string
	Phone          string
	TrackingNumber string
}

aantelov87 avatar Nov 30 '17 13:11 aantelov87

I'm seeing this as well

jwilander avatar Jul 19 '18 19:07 jwilander