mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 13:02:14 +00:00
[go-to-protobuf] Quote tag cast{key,value,type}
When using a `cast{key,value,type}` that was injected via struct tag, we need to make sure to quote the value when transfering it over to proto tags. Otherwise, it'll come through as unquoted, resulting in invalid proto. This was previously not a problem, since all values of `castkey` and `casttype` were actually coming from the auto-injecting code which deals with maps and aliases, which does correctly quote values.
This commit is contained in:
parent
7b8e572d8a
commit
85c3ca1013
@ -598,7 +598,7 @@ func protobufTagToField(tag string, field *protoField, m types.Member, t *types.
|
||||
protoExtra[parts[0]] = parts[1]
|
||||
case "casttype", "castkey", "castvalue":
|
||||
parts[0] = fmt.Sprintf("(gogoproto.%s)", parts[0])
|
||||
protoExtra[parts[0]] = parts[1]
|
||||
protoExtra[parts[0]] = strconv.Quote(parts[1])
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user