Skip to content
Changes

Reference

sqlserver · Nov 11, 2026

What this change means

Source files changed in ways the catalog does not model (for example logic inside Verify). Read the diff to judge the effect.

pkg/detectors/sqlserver/sqlserver.go+24−9View file
@@ -126,19 +126,34 @@ func shouldIgnore(uri string, ignorePatterns []*regexp.Regexp) bool {
126126 return false
127127}
128128
129added: const defaultSQLServerPort = 1433
130added:
131added: // preDialAddress returns the host:port the driver will dial, or false when the
132added: // port is resolved through SQL Browser and can't be checked ahead of time.
133added: func preDialAddress(config msdsn.Config) (string, bool) {
134added: port := config.Port
135added: if port == 0 {
136added: if config.Instance != "" {
137added: return "", false
138added: }
139added: port = defaultSQLServerPort
140added: }
141added: return net.JoinHostPort(config.Host, strconv.Itoa(int(port))), true
142added: }
143added:
129144var ping = func(ctx context.Context, config msdsn.Config) (bool, error) {
130145 // TCP connectivity check to prevent indefinite hangs
131removed: address := net.JoinHostPort(config.Host, strconv.Itoa(int(config.Port)))
132removed:
133removed: dialer := &net.Dialer{
134removed: Timeout: 3 * time.Second,
135removed: }
146added: if address, ok := preDialAddress(config); ok {
147added: dialer := &net.Dialer{
148added: Timeout: 3 * time.Second,
149added: }
136150
137removed: tcpConn, err := dialer.DialContext(ctx, "tcp", address) // respects context timeout
138removed: if err != nil {
139removed: return false, err
151added: tcpConn, err := dialer.DialContext(ctx, "tcp", address) // respects context timeout
152added: if err != nil {
153added: return false, err
154added: }
155added: defer func() { _ = tcpConn.Close() }()
140156 }
141removed: defer func() { _ = tcpConn.Close() }()
142157
143158 cleanConfig := msdsn.Config{}
144159 cleanConfig.Host = config.Host