Use standardized, collision-resistant naming for public identifiers—especially versioned module paths and generated-code symbols.
Apply this in two common cases:
1) Module/version identifiers
v4.0.0), not just v4..../pkg/iptables/v4 when moving to a v4-tagged release).2) Constrained API fields (enums)
enum over string when the field has a fixed set of allowed values.Example (proto):
message LinuxContainerSecurityContext {
enum CgroupMountMode {
CGROUP_MOUNT_MODE_READ_ONLY = 0;
CGROUP_MOUNT_MODE_WRITABLE = 1;
}
CgroupMountMode cgroup_mount_mode = 18;
}
Result: builds don’t unexpectedly treat versions as SHAs, imports stay consistent across major versions, and generated symbols remain stable and collision-free.