parseChatID returns the chat UUID from the flag value (which serpent already populates from --chat or CODER_CHAT_ID). Returns uuid.Nil if empty (the server will auto-detect).
(flagValue string)
| 183 | // serpent already populates from --chat or CODER_CHAT_ID). Returns |
| 184 | // uuid.Nil if empty (the server will auto-detect). |
| 185 | func parseChatID(flagValue string) (uuid.UUID, error) { |
| 186 | if flagValue == "" { |
| 187 | return uuid.Nil, nil |
| 188 | } |
| 189 | parsed, err := uuid.Parse(flagValue) |
| 190 | if err != nil { |
| 191 | return uuid.Nil, xerrors.Errorf("invalid chat ID %q: %w", flagValue, err) |
| 192 | } |
| 193 | return parsed, nil |
| 194 | } |
no test coverage detected