Skip to content

Commit ecec84e

Browse files
Correct format specifier for port (#489)
1 parent 99b49ff commit ecec84e

File tree

19 files changed

+697
-697
lines changed

19 files changed

+697
-697
lines changed

cmd/modern/root/config/connection-strings.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ func (c *ConnectionStrings) run() {
5858

5959
// connectionStringFormats borrowed from "portal.azure.com" "connection strings" pane
6060
var connectionStringFormats = map[string]string{
61-
"ADO.NET": "Server=tcp:%s,%d;Initial Catalog=%s;Persist Security Info=False;User ID=%s;Password=%s;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=%s;Connection Timeout=30;",
62-
"JDBC": "jdbc:sqlserver://%s:%d;database=%s;user=%s;password=%s;encrypt=true;trustServerCertificate=%s;loginTimeout=30;",
63-
"ODBC": "Driver={ODBC Driver 18 for SQL Server};Server=tcp:%s,%d;Database=%s;Uid=%s;Pwd=%s;Encrypt=yes;TrustServerCertificate=%s;Connection Timeout=30;",
61+
"ADO.NET": "Server=tcp:%s,%#v;Initial Catalog=%s;Persist Security Info=False;User ID=%s;Password=%s;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=%s;Connection Timeout=30;",
62+
"JDBC": "jdbc:sqlserver://%s:%#v;database=%s;user=%s;password=%s;encrypt=true;trustServerCertificate=%s;loginTimeout=30;",
63+
"ODBC": "Driver={ODBC Driver 18 for SQL Server};Server=tcp:%s,%#v;Database=%s;Uid=%s;Pwd=%s;Encrypt=yes;TrustServerCertificate=%s;Connection Timeout=30;",
6464
"GO": "sqlserver://%s:%s@%s,%d?database=%s;encrypt=true;trustServerCertificate=%s;dial+timeout=30",
65-
"SQLCMD": "sqlcmd -S %s,%d -U %s",
65+
"SQLCMD": "sqlcmd -S %s,%#v -U %s",
6666
}
6767

6868
endpoint, user := config.CurrentContext()

cmd/modern/root/install/mssql-base.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ func (c *MssqlBase) createContainer(imageName string, contextName string) {
391391
hints = append(hints, []string{localizer.Sprintf("Remove"), "sqlcmd delete"})
392392

393393
output.InfoWithHintExamples(hints,
394-
localizer.Sprintf("Now ready for client connections on port %d",
394+
localizer.Sprintf("Now ready for client connections on port %#v",
395395
c.port),
396396
)
397397
}

cmd/modern/root/open/ads.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func (c *Ads) launchAds(host string, port int, username string) {
7171
"-r",
7272
fmt.Sprintf(
7373
"--server=%s", fmt.Sprintf(
74-
"%s,%d",
74+
"%s,%#v",
7575
host,
7676
port)),
7777
}

cmd/modern/root/open/ads_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (c *Ads) persistCredentialForAds(
3939
) {
4040
// Create the target name that ADS will look for
4141
targetName := c.adsKey(
42-
fmt.Sprintf("%s,%d", hostname, rune(endpoint.Port)),
42+
fmt.Sprintf("%s,%#v", hostname, rune(endpoint.Port)),
4343
"", // The default database is set on the user login
4444
"SqlLogin",
4545
user.BasicAuth.Username)

internal/net/net.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func IsLocalPortAvailable(port int) (portAvailable bool) {
1616

1717
hostPort := net.JoinHostPort("localhost", strconv.Itoa(port))
1818
trace(
19-
"Checking if local port %d is available using DialTimeout(tcp, %v, timeout: %d)",
19+
"Checking if local port %#v is available using DialTimeout(tcp, %v, timeout: %d)",
2020
port,
2121
hostPort,
2222
timeout,
@@ -28,7 +28,7 @@ func IsLocalPortAvailable(port int) (portAvailable bool) {
2828
)
2929
if err != nil {
3030
trace(
31-
"Expected connecting error '%v' on local port %d, therefore port is available)",
31+
"Expected connecting error '%v' on local port %#v, therefore port is available)",
3232
err,
3333
port,
3434
)
@@ -37,9 +37,9 @@ func IsLocalPortAvailable(port int) (portAvailable bool) {
3737
if conn != nil {
3838
err := conn.Close()
3939
checkErr(err)
40-
trace("Local port '%d' is not available", port)
40+
trace("Local port '%#v' is not available", port)
4141
} else {
42-
trace("Local port '%d' is available", port)
42+
trace("Local port '%#v' is available", port)
4343
}
4444

4545
return

internal/net/net_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ func TestIsLocalPortAvailable(t *testing.T) {
1717
isPortAvailable := IsLocalPortAvailable(i)
1818
if isPortAvailable {
1919
testedPortAvailable = true
20-
t.Logf("Port %d is available", i)
20+
t.Logf("Port %#v is available", i)
2121
} else {
2222
testedNotPortAvailable = true
23-
t.Logf("Port %d is not available", i)
23+
t.Logf("Port %#v is not available", i)
2424
}
2525
if testedPortAvailable && testedNotPortAvailable {
2626
return

internal/sql/mssql.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (m *mssql) Connect(
3535
m.sqlcmd.Format = sqlcmd.NewSQLCmdDefaultFormatter(false, sqlcmd.ControlIgnore)
3636
connect := sqlcmd.ConnectSettings{
3737
ServerName: fmt.Sprintf(
38-
"%s,%d",
38+
"%s,%#v",
3939
endpoint.EndpointDetails.Address,
4040
endpoint.EndpointDetails.Port),
4141
ApplicationName: "sqlcmd",

internal/translations/catalog.go

Lines changed: 672 additions & 672 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/translations/locales/de-DE/out.gotext.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@
21272127
"placeholders": [
21282128
{
21292129
"id": "Port",
2130-
"string": "%[1]d",
2130+
"string": "%#[1]v",
21312131
"type": "int",
21322132
"underlyingType": "int",
21332133
"argNum": 1,

internal/translations/locales/en-US/out.gotext.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@
21272127
"placeholders": [
21282128
{
21292129
"id": "Port",
2130-
"string": "%[1]d",
2130+
"string": "%#[1]v",
21312131
"type": "int",
21322132
"underlyingType": "int",
21332133
"argNum": 1,

internal/translations/locales/es-ES/out.gotext.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@
21272127
"placeholders": [
21282128
{
21292129
"id": "Port",
2130-
"string": "%[1]d",
2130+
"string": "%#[1]v",
21312131
"type": "int",
21322132
"underlyingType": "int",
21332133
"argNum": 1,

internal/translations/locales/fr-FR/out.gotext.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@
21272127
"placeholders": [
21282128
{
21292129
"id": "Port",
2130-
"string": "%[1]d",
2130+
"string": "%#[1]v",
21312131
"type": "int",
21322132
"underlyingType": "int",
21332133
"argNum": 1,

internal/translations/locales/it-IT/out.gotext.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@
21272127
"placeholders": [
21282128
{
21292129
"id": "Port",
2130-
"string": "%[1]d",
2130+
"string": "%#[1]v",
21312131
"type": "int",
21322132
"underlyingType": "int",
21332133
"argNum": 1,

internal/translations/locales/ja-JP/out.gotext.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@
21272127
"placeholders": [
21282128
{
21292129
"id": "Port",
2130-
"string": "%[1]d",
2130+
"string": "%#[1]v",
21312131
"type": "int",
21322132
"underlyingType": "int",
21332133
"argNum": 1,

internal/translations/locales/ko-KR/out.gotext.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@
21272127
"placeholders": [
21282128
{
21292129
"id": "Port",
2130-
"string": "%[1]d",
2130+
"string": "%#[1]v",
21312131
"type": "int",
21322132
"underlyingType": "int",
21332133
"argNum": 1,

internal/translations/locales/pt-BR/out.gotext.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@
21272127
"placeholders": [
21282128
{
21292129
"id": "Port",
2130-
"string": "%[1]d",
2130+
"string": "%#[1]v",
21312131
"type": "int",
21322132
"underlyingType": "int",
21332133
"argNum": 1,

internal/translations/locales/ru-RU/out.gotext.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@
21272127
"placeholders": [
21282128
{
21292129
"id": "Port",
2130-
"string": "%[1]d",
2130+
"string": "%#[1]v",
21312131
"type": "int",
21322132
"underlyingType": "int",
21332133
"argNum": 1,

internal/translations/locales/zh-CN/out.gotext.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@
21272127
"placeholders": [
21282128
{
21292129
"id": "Port",
2130-
"string": "%[1]d",
2130+
"string": "%#[1]v",
21312131
"type": "int",
21322132
"underlyingType": "int",
21332133
"argNum": 1,

internal/translations/locales/zh-TW/out.gotext.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@
21272127
"placeholders": [
21282128
{
21292129
"id": "Port",
2130-
"string": "%[1]d",
2130+
"string": "%#[1]v",
21312131
"type": "int",
21322132
"underlyingType": "int",
21332133
"argNum": 1,

0 commit comments

Comments
 (0)