doubleclick protobuf file load to project

1,download protobuf file to local

wget https://developers.google.com/ad-exchange/rtb/downloads/openrtb-proto.txt

wget https://developers.google.com/ad-exchange/rtb/downloads/openrtb-adx-proto.txt

2,move to protofile 

mv   openrtb-proto.txt  openrtb.proto

mv openrtb-adx-proto.txt openrtb_adx.proto

3,edit two protofile to same package 

update   openrtb_adx.proto use  new package name "your self package name " not "com.google.doubleclick"

eg:  package openrtb; 

4,generate to go file 

protoc  --go_out=. openrtb.proto    openrtb_adx.proto

5,set protobuf exten field  example:

    if err := proto.SetExtension(&seatBidBid, openrtb.E_Bid, bidExt); err != nil {
        logger.Warn( exchange, " set impTrackers Error[", err, "]")
        return false
    }
原文地址:https://www.cnblogs.com/lavin/p/7081762.html