aboutsummaryrefslogtreecommitdiff
path: root/internal/db/db.go
diff options
context:
space:
mode:
authorᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-04-10 22:51:24 +0800
committerGitHub <noreply@github.com>2020-04-10 22:51:24 +0800
commite186a3d2c95aee3c652b010c2c08ed771590b86b (patch)
tree5b4f5637cef8a76cac979f2d225f540b141facea /internal/db/db.go
parent9a5b227f3ee2b2a3854d3aec022cc9a0cf0868b3 (diff)
db: add tests for helper functions (#6084)
Diffstat (limited to 'internal/db/db.go')
-rw-r--r--internal/db/db.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/db/db.go b/internal/db/db.go
index 85503533..e3796039 100644
--- a/internal/db/db.go
+++ b/internal/db/db.go
@@ -27,8 +27,8 @@ import (
// parsePostgreSQLHostPort parses given input in various forms defined in
// https://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING
// and returns proper host and port number.
-func parsePostgreSQLHostPort(info string) (string, string) {
- host, port := "127.0.0.1", "5432"
+func parsePostgreSQLHostPort(info string) (host, port string) {
+ host, port = "127.0.0.1", "5432"
if strings.Contains(info, ":") && !strings.HasSuffix(info, "]") {
idx := strings.LastIndex(info, ":")
host = info[:idx]
@@ -39,8 +39,8 @@ func parsePostgreSQLHostPort(info string) (string, string) {
return host, port
}
-func parseMSSQLHostPort(info string) (string, string) {
- host, port := "127.0.0.1", "1433"
+func parseMSSQLHostPort(info string) (host, port string) {
+ host, port = "127.0.0.1", "1433"
if strings.Contains(info, ":") {
host = strings.Split(info, ":")[0]
port = strings.Split(info, ":")[1]