Documentation ¶
Index ¶
- Constants
- Variables
- func Commit(ignore string) (io.Reader, error)
- func Init(ignore string) (io.Reader, error)
- func SetDebug(status bool)
- func SetStrict(mode bool)
- type Definition
- type Entry
- type Enum
- type EnumField
- type Field
- type Map
- type Message
- type ProtoFile
- type Protolock
- type RPC
- type Report
- type RuleFunc
- type Service
- type Warning
- func NoChangingFieldIDs(cur, upd Protolock) ([]Warning, bool)
- func NoChangingFieldNames(cur, upd Protolock) ([]Warning, bool)
- func NoChangingFieldTypes(cur, upd Protolock) ([]Warning, bool)
- func NoChangingRPCSignature(cur, upd Protolock) ([]Warning, bool)
- func NoRemovingFieldsWithoutReserve(cur, upd Protolock) ([]Warning, bool)
- func NoRemovingRPCs(cur, upd Protolock) ([]Warning, bool)
- func NoRemovingReservedFields(cur, upd Protolock) ([]Warning, bool)
- func NoUsingReservedFields(cur, upd Protolock) ([]Warning, bool)
Constants ¶
const (
// CommentSkip tells the parse step to skip the comparable entity.
CommentSkip = "@protolock:skip"
)
const LockFileName = "proto.lock"
Variables ¶
var ( // ErrSkipEntry indicates that the CommentSkip hint was found. ErrSkipEntry = errors.New("protolock: skip entry hint encountered") )
Functions ¶
func Commit ¶
Commit will return an io.Reader with the lock representation data for caller to use as needed.
func Init ¶
Init will return an io.Reader with the lock representation data for caller to use as needed.
Types ¶
type Definition ¶
type Definition struct { Filepath protopath `json:"protopath,omitempty"` Def Entry `json:"def,omitempty"` }
type Message ¶
type Message struct { Name string `json:"name,omitempty"` Fields []Field `json:"fields,omitempty"` Maps []Map `json:"maps,omitempty"` ReservedIDs []int `json:"reserved_ids,omitempty"` ReservedNames []string `json:"reserved_names,omitempty"` Filepath protopath `json:"filepath,omitempty"` Messages []Message `json:"messages,omitempty"` }
type Protolock ¶
type Protolock struct {
Definitions []Definition `json:"definitions,omitempty"`
}
type RuleFunc ¶
RuleFunc defines the common signature for a function which can compare Protolock states and determine if issues exist.
type Warning ¶
type Warning struct { Filepath protopath Message string }
func NoChangingFieldIDs ¶
NoChangingFieldIDs compares the current vs. updated Protolock definitions and will return a list of warnings if any field ID number has been changed.
func NoChangingFieldNames ¶
NoChangingFieldNames compares the current vs. updated Protolock definitions and will return a list of warnings if any message's previous fields have been renamed. This rule is only enforced when strict mode is enabled.
func NoChangingFieldTypes ¶
NoChangingFieldTypes compares the current vs. updated Protolock definitions and will return a list of warnings if any field type has been changed.
func NoChangingRPCSignature ¶
NoChangingRPCSignature compares the current vs. updated Protolock definitions and will return a list of warnings if any RPC signature has been changed while using the same name.
func NoRemovingFieldsWithoutReserve ¶
NoRemovingFieldsWithoutReserve compares the current vs. updated Protolock definitions and will return a list of warnings if any field has been removed without a corresponding reservation of that field name or ID.
func NoRemovingRPCs ¶
NoRemovingRPCs compares the current vs. updated Protolock definitions and will return a list of warnings if any RPCs provided by a Service have been removed. This rule is only enforced when strict mode is enabled.
func NoRemovingReservedFields ¶
NoRemovingReservedFields compares the current vs. updated Protolock definitions and will return a list of warnings if any reserved field has been removed. This rule is only enforced when strict mode is enabled.
func NoUsingReservedFields ¶
NoUsingReservedFields compares the current vs. updated Protolock definitions and will return a list of warnings if any message's previously reserved fields or IDs are now being used as part of the same message.