Skip to content

Commit b8a9fa1

Browse files
golangci-lint: add nosprintfhostport linter, fix problems (#18902)
Signed-off-by: Tim Vaillancourt <[email protected]>
1 parent d91187e commit b8a9fa1

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ linters:
1212
- ineffassign
1313
- mirror
1414
- nolintlint
15+
- nosprintfhostport
1516
- perfsprint
1617
- sqlclosecheck
1718
- staticcheck
@@ -155,6 +156,7 @@ linters:
155156
path: ^go/stats/statsd/
156157
- linters:
157158
- errcheck
159+
- nosprintfhostport
158160
- sqlclosecheck
159161
path: ^go/test/
160162
- linters:

go/vt/vttest/local_cluster.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ import (
2323
"errors"
2424
"fmt"
2525
"io"
26+
"net"
2627
"net/http"
2728
"os"
2829
"os/exec"
2930
"path"
3031
"path/filepath"
32+
"strconv"
3133
"strings"
3234
"time"
3335
"unicode"
@@ -800,7 +802,7 @@ func (db *LocalCluster) VTProcess() *VtProcess {
800802
// a pointer to the interface. To read this vschema, the caller must convert it to a map
801803
func (vt *VtProcess) ReadVSchema() (*interface{}, error) {
802804
httpClient := &http.Client{Timeout: 5 * time.Second}
803-
resp, err := httpClient.Get(fmt.Sprintf("http://%s:%d/debug/vschema", vt.BindAddress, vt.Port))
805+
resp, err := httpClient.Get("http://" + net.JoinHostPort(vt.BindAddress, strconv.Itoa(vt.Port)) + "/debug/vschema")
804806
if err != nil {
805807
return nil, err
806808
}

0 commit comments

Comments
 (0)