Set proto go_package: kubelet example_plugin_apis

This creates some diff to the *.pb.go files to note that
in the "options".

You can dump the gzipped blob with the following program (thanks
StackOverflow!):

```go
package main

import (
	"bytes"
	"compress/gzip"
	"encoding/json"
	"fmt"
	"os"

	"io/ioutil"

	proto "github.com/golang/protobuf/proto"
	dpb "github.com/golang/protobuf/protoc-gen-go/descriptor"
)

func main() {
	m := map[string][]byte{
		"before": blobv1,
		"after": blobv2,
	}
	arg := os.Args[1]
	dump(m[arg])
}

func dump(bytes []byte) {
	fd, err := decodeFileDesc(bytes)
	if err != nil {
		panic(err)
	}
	b, err := json.MarshalIndent(fd, "", "  ")
	if err != nil {
		panic(err)
	}
	fmt.Println(string(b))
}

// decompress does gzip decompression.
func decompress(b []byte) ([]byte, error) {
	r, err := gzip.NewReader(bytes.NewReader(b))
	if err != nil {
		return nil, fmt.Errorf("bad gzipped descriptor: %v", err)
	}
	out, err := ioutil.ReadAll(r)
	if err != nil {
		return nil, fmt.Errorf("bad gzipped descriptor: %v", err)
	}
	return out, nil
}

func decodeFileDesc(enc []byte) (*dpb.FileDescriptorProto, error) {
	raw, err := decompress(enc)
	if err != nil {
		return nil, fmt.Errorf("failed to decompress enc: %v", err)
	}

	fd := new(dpb.FileDescriptorProto)
	if err := proto.Unmarshal(raw, fd); err != nil {
		return nil, fmt.Errorf("bad descriptor: %v", err)
	}
	return fd, nil
}
```
This commit is contained in:
Tim Hockin 2023-01-14 10:16:02 -08:00
parent a58e899392
commit 60ffa47f4f
No known key found for this signature in database
4 changed files with 40 additions and 32 deletions

View File

@ -151,22 +151,25 @@ func init() {
func init() { proto.RegisterFile("api.proto", fileDescriptor_00212fb1f9d3bf1c) }
var fileDescriptor_00212fb1f9d3bf1c = []byte{
// 227 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4c, 0x2c, 0xc8, 0xd4,
0x2b, 0x28, 0xca, 0x2f, 0xc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x1c, 0x43,
0x12, 0x1b, 0xd8, 0xc3, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x99, 0x62, 0xd1, 0x9c, 0x35,
0x01, 0x00, 0x00,
// 287 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xbf, 0x4a, 0x34, 0x31,
0x14, 0xc5, 0x37, 0x1f, 0x7c, 0x2e, 0x1b, 0x74, 0x85, 0x20, 0x38, 0x6c, 0x11, 0x64, 0x2c, 0xb4,
0x71, 0xc2, 0x6a, 0x63, 0x2d, 0xac, 0x62, 0xa5, 0x2c, 0xd8, 0xd8, 0x0c, 0x99, 0xf5, 0x4e, 0x36,
0xcc, 0x9f, 0xc4, 0x24, 0xa3, 0x96, 0x3e, 0x82, 0x8f, 0xb5, 0xa5, 0xa5, 0xa5, 0x3b, 0xbe, 0x88,
0x98, 0x44, 0x41, 0xec, 0xee, 0xef, 0x9c, 0xe4, 0x9c, 0xcb, 0xc5, 0x23, 0xae, 0x65, 0xa6, 0x8d,
0x72, 0x8a, 0x0c, 0x1f, 0xa6, 0x05, 0x38, 0x3e, 0x9d, 0x1c, 0x09, 0xe9, 0x96, 0x5d, 0x91, 0x2d,
0x54, 0xc3, 0x84, 0x12, 0x8a, 0x79, 0xbf, 0xe8, 0x4a, 0x4f, 0x1e, 0xfc, 0x14, 0xfe, 0xa5, 0x57,
0x78, 0x3c, 0x7b, 0xe2, 0x8d, 0xae, 0x61, 0x0e, 0xf7, 0x1d, 0x58, 0x47, 0x12, 0x3c, 0x34, 0x61,
0x4c, 0xd0, 0x1e, 0x3a, 0x1c, 0xcd, 0xbf, 0x91, 0xec, 0xe3, 0xad, 0xd8, 0x92, 0x97, 0x12, 0xea,
0xbb, 0xe4, 0x9f, 0xf7, 0x37, 0xa3, 0x78, 0xfe, 0xa5, 0xa5, 0x07, 0x78, 0xfb, 0x27, 0xd0, 0x6a,
0xd5, 0x5a, 0x20, 0x3b, 0xf8, 0x3f, 0x18, 0xa3, 0x4c, 0xcc, 0x0b, 0x70, 0x7c, 0x8d, 0x87, 0xf1,
0x21, 0x99, 0xe1, 0xf1, 0x05, 0xb8, 0x48, 0x97, 0x6d, 0xa9, 0xc8, 0x6e, 0x16, 0x43, 0xb3, 0xdf,
0xdb, 0x4d, 0x92, 0xbf, 0x46, 0x68, 0x49, 0x07, 0x67, 0x76, 0xb5, 0xa6, 0xe8, 0x6d, 0x4d, 0x07,
0xcf, 0x3d, 0x45, 0xab, 0x9e, 0xa2, 0xd7, 0x9e, 0xa2, 0xf7, 0x9e, 0xa2, 0x97, 0x0f, 0x3a, 0xb8,
0xbd, 0xa9, 0x4e, 0x6d, 0x26, 0x15, 0xab, 0xba, 0x02, 0x4c, 0x0b, 0x0e, 0x2c, 0xd3, 0x95, 0xf0,
0x58, 0x83, 0x63, 0xba, 0xee, 0x84, 0x6c, 0x1b, 0xde, 0x72, 0x01, 0x26, 0xd2, 0x23, 0x77, 0x8b,
0x25, 0x18, 0x06, 0xa1, 0x2a, 0x0f, 0x6a, 0xce, 0xb5, 0xb4, 0x2c, 0xae, 0x51, 0x6c, 0xf8, 0x3b,
0x9e, 0x7c, 0x06, 0x00, 0x00, 0xff, 0xff, 0x25, 0xab, 0xfe, 0x7d, 0x8c, 0x01, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

View File

@ -17,6 +17,7 @@ limitations under the License.
syntax = "proto3";
package v1beta1;
option go_package = "k8s.io/kubernetes/pkg/kubelet/pluginmanager/pluginwatcher/example_plugin_apis/v1beta1";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";

View File

@ -152,22 +152,25 @@ func init() {
func init() { proto.RegisterFile("api.proto", fileDescriptor_00212fb1f9d3bf1c) }
var fileDescriptor_00212fb1f9d3bf1c = []byte{
// 227 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,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x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0x43,
0x12, 0x1b, 0xd8, 0xc3, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa8, 0x79, 0x17, 0x13, 0x35,
0x01, 0x00, 0x00,
// 287 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xbf, 0x4a, 0x34, 0x31,
0x14, 0xc5, 0x37, 0x1f, 0x7c, 0x2e, 0x1b, 0x74, 0x85, 0x20, 0x38, 0x6c, 0x11, 0x64, 0x2c, 0xb4,
0x71, 0x82, 0x6b, 0x63, 0x2d, 0xac, 0x62, 0xa5, 0x2c, 0xd8, 0xd8, 0x0c, 0x99, 0xf5, 0x4e, 0x36,
0xcc, 0x9f, 0xc4, 0x24, 0xa3, 0x96, 0x3e, 0x82, 0x8f, 0xb5, 0xa5, 0xa5, 0xa5, 0x3b, 0xbe, 0x88,
0x98, 0x44, 0x41, 0xec, 0xee, 0xef, 0x9c, 0xe4, 0x9c, 0xcb, 0xc5, 0x23, 0xae, 0x65, 0xa6, 0x8d,
0x72, 0x8a, 0x0c, 0x1f, 0x8e, 0x0b, 0x70, 0x7c, 0x3a, 0x39, 0x12, 0xd2, 0x2d, 0xbb, 0x22, 0x5b,
0xa8, 0x86, 0x09, 0x25, 0x14, 0xf3, 0x7e, 0xd1, 0x95, 0x9e, 0x3c, 0xf8, 0x29, 0xfc, 0x4b, 0xaf,
0xf0, 0x78, 0xf6, 0xc4, 0x1b, 0x5d, 0xc3, 0x1c, 0xee, 0x3b, 0xb0, 0x8e, 0x24, 0x78, 0x68, 0xc2,
0x98, 0xa0, 0x3d, 0x74, 0x38, 0x9a, 0x7f, 0x23, 0xd9, 0xc7, 0x5b, 0xb1, 0x25, 0x2f, 0x25, 0xd4,
0x77, 0xc9, 0x3f, 0xef, 0x6f, 0x46, 0xf1, 0xfc, 0x4b, 0x4b, 0x0f, 0xf0, 0xf6, 0x4f, 0xa0, 0xd5,
0xaa, 0xb5, 0x40, 0x76, 0xf0, 0x7f, 0x30, 0x46, 0x99, 0x98, 0x17, 0x60, 0x7a, 0x8d, 0x87, 0xf1,
0x21, 0x99, 0xe1, 0xf1, 0x05, 0xb8, 0x48, 0x97, 0x6d, 0xa9, 0xc8, 0x6e, 0x16, 0x43, 0xb3, 0xdf,
0xdb, 0x4d, 0x92, 0xbf, 0x46, 0x68, 0x49, 0x07, 0x67, 0x76, 0xb5, 0xa6, 0xe8, 0x6d, 0x4d, 0x07,
0xcf, 0x3d, 0x45, 0xab, 0x9e, 0xa2, 0xd7, 0x9e, 0xa2, 0xf7, 0x9e, 0xa2, 0x97, 0x0f, 0x3a, 0xb8,
0xbd, 0xa9, 0x4e, 0x6d, 0x26, 0x15, 0xab, 0xba, 0x02, 0x4c, 0x0b, 0x0e, 0x2c, 0xd3, 0x95, 0xf0,
0x58, 0x83, 0x63, 0xba, 0xee, 0x84, 0x6c, 0x1b, 0xde, 0x72, 0x01, 0x26, 0xd2, 0x23, 0x77, 0x8b,
0x25, 0x18, 0x06, 0xa1, 0x2a, 0x0f, 0x6a, 0xce, 0xb5, 0xb4, 0x2c, 0xae, 0x51, 0x6c, 0xf8, 0x3b,
0x9e, 0x7c, 0x06, 0x00, 0x00, 0xff, 0xff, 0x28, 0x67, 0xcf, 0xa3, 0x8c, 0x01, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

View File

@ -17,6 +17,7 @@ limitations under the License.
syntax = "proto3";
package v1beta2;
option go_package = "k8s.io/kubernetes/pkg/kubelet/pluginmanager/pluginwatcher/example_plugin_apis/v1beta2";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";