You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems to me this switch case in SerializeRuntimeAddServer which formats attributes to pass to the "add server" command doesn't fallthrough on each case:
// Address is mandatory and must come first, with an optional port number.
addr:=srv.Address
ifsrv.Port!=nil {
addr+=fmt.Sprintf(":%d", *srv.Port)
}
push(addr)
switch {
caseenabled(srv.AgentCheck):
push("agent-check")
casesrv.AgentAddr!="":
pushq("agent-addr", srv.AgentAddr)
casesrv.AgentPort!=nil:
Therefore, the first case which matches, the switch is finished and won't insert the rest of the desired parameters into the resulting output string.
Golang switch statements break and don't fallthrough by default afaik, so this can be easily remedied by adding the fallthrough label to each case or using if statements.
Sorry, I've not got the time to make a PR myself.
Edit: I think it also misquotes some params using pushq, e.g. "verify" should not become verify "required", but simply verify required. The former will be rejected by the runtime API.
Cheers.
The text was updated successfully, but these errors were encountered:
fatchan
changed the title
Missing fallthrough in AddServer attributes formatting switch statement
Missing fallthrough in SerializeRuntimeAddServer attributes formatting switch statement
Mar 16, 2025
Hi,
It seems to me this switch case in
SerializeRuntimeAddServer
which formats attributes to pass to the "add server" command doesn't fallthrough on each case:dataplaneapi/handlers/runtime_server.go
Lines 239 to 269 in 1b63b07
Therefore, the first case which matches, the switch is finished and won't insert the rest of the desired parameters into the resulting output string.
Golang switch statements break and don't fallthrough by default afaik, so this can be easily remedied by adding the fallthrough label to each case or using if statements.
Sorry, I've not got the time to make a PR myself.
Edit: I think it also misquotes some params using
pushq
, e.g. "verify" should not becomeverify "required"
, but simplyverify required
. The former will be rejected by the runtime API.Cheers.
The text was updated successfully, but these errors were encountered: