github.com/argoproj/argo-cd@v1.8.7/pkg/apis/application/v1alpha1/hack.go (about)

     1  package v1alpha1
     2  
     3  // objectMeta and corresponding GetMetadata() methods is a hack to allow us to use grpc-gateway
     4  // side-by-side with k8s protobuf codegen. The grpc-gateway generated .gw.pb.go files expect a
     5  // GetMetadata() method to be generated because it assumes the .proto files were generated from
     6  // protoc --go_out=plugins=grpc. Instead, kubernetes uses go-to-protobuf to generate .proto files
     7  // from go types, and this method is not auto-generated (presumably since ObjectMeta is embedded but
     8  // is nested in the 'metadata' field in JSON form).
     9  type objectMeta struct {
    10  	Name *string
    11  }
    12  
    13  func (a *Application) GetMetadata() *objectMeta {
    14  	var om objectMeta
    15  	if a != nil {
    16  		om.Name = &a.Name
    17  	}
    18  	return &om
    19  }