Documentation ¶
Index ¶
- func GetCommentExcludes(options option.Options) ([]string, error)
- func GetEnumZeroValueSuffix(options option.Options) (string, error)
- func GetRPCAllowGoogleProtobufEmptyRequests(options option.Options) (bool, error)
- func GetRPCAllowGoogleProtobufEmptyResponses(options option.Options) (bool, error)
- func GetRPCAllowSameRequestResponse(options option.Options) (bool, error)
- func GetServiceSuffix(options option.Options) (string, error)
- type OptionsSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCommentExcludes ¶
CommentExcludes are lines of comments that should be excluded for the COMMENT.* Rules.
If a comment line starts with one of these excludes, it is not considered an actual comment.
The returned slice is guaranteed to have only non-empty elements.
func GetEnumZeroValueSuffix ¶
GetEnumZeroValueSuffix gets the enum zero-value suffix.
Returns the default suffix if the option is not set.
func GetRPCAllowGoogleProtobufEmptyRequests ¶
GetRPCAllowGoogleProtobufEmptyRequests returns true if the rpc_allow_google_protobuf_empty_requests option is set to true.
Returns error if the value was unrecognized.
func GetRPCAllowGoogleProtobufEmptyResponses ¶
GetRPCAllowGoogleProtobufEmptyResponses returns true if the rpc_allow_google_protobuf_empty_responses option is set to true.
Returns error if the value was unrecognized.
func GetRPCAllowSameRequestResponse ¶
GetRPCAllowSameRequestResponse returns true if the rpc_allow_same_request_response option is set to true.
Returns error if the value was unrecognized.
Types ¶
type OptionsSpec ¶
type OptionsSpec struct { EnumZeroValueSuffix string RPCAllowSameRequestResponse bool RPCAllowGoogleProtobufEmptyRequests bool RPCAllowGoogleProtobufEmptyResponses bool ServiceSuffix string // CommentExcludes are lines of comments that should be excluded for the COMMENT.* Rules. // // If a comment line starts with one of these excludes, it is not considered an actual comment. // // Right now, this should just be []string{"buf:lint:ignore"}, however we do this as a proper option // to maintain the client/server split we want; the server (ie the Rules) should not have the lint comment // ignore strings as part of their logic, all lint comment ignore logic is a client-side concern. However, // it is conceivable that a COMMENT.* Rule might want to say "I don't want to consider this generic // line to be a comment", which is exclusive of the lint comment ignore logic. We could even potentially // give users the ability to configure things to ignore as part of their buf.yaml configuration. So, // this feels OK to expose here. // // In practice, right now, the client-side should just set this to be []string{"buf:lint:ignore"}. // // All elements must be non-empty. CommentExcludes []string }
OptionsSpec builds option.Options for clients.
These can then be sent over the wire to servers.
Note that we don't expose OptionsSpec for the server-side rules, instead we rely on the static functions, as we want to move our rules to be as native to bufplugin-go as possible. Instead of i.e. attaching an Options struct to bufcheckserverutil.Requests, we have individual rules go through the direct reading of option.Options using the static functions below.
Only use this on the client side.