/
githubmirror
/
ydb-go-persqueue-sdk
Обзор
Документация
Войти
/
githubmirror
/
ydb-go-persqueue-sdk
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
session/util.go
22 строки
332 B
Aleksandr Petrukhin
[session] add endpoint format if port is present
21 янв 2022, 19:00
21 янв 2022, 19:00
7bcec83
Код
Авторство
О чём код?
package session import "fmt" func formatEndpoint(endpoint string, port int) string { if len(endpoint) == 0 { return "" } hasPort := false for i := len(endpoint) - 1; i >= 0; i-- { if endpoint[i] == ':' { hasPort = true break } } if hasPort { return endpoint } return fmt.Sprintf("%s:%d", endpoint, port) }