Skip to content

Commit f6fda23

Browse files
committed
Merge remote-tracking branch 'upstream/master' into query_attributes
2 parents 5b4d37f + b039e99 commit f6fda23

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

client/conn.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"net"
99
"runtime"
10+
"runtime/debug"
1011
"strings"
1112
"time"
1213

@@ -105,12 +106,19 @@ func ConnectWithDialer(ctx context.Context, network, addr, user, password, dbNam
105106

106107
c.BufferSize = defaultBufferSize
107108
c.attributes = map[string]string{
108-
"_client_name": "go-mysql",
109-
// "_client_version": "0.1",
109+
"_client_name": "go-mysql",
110110
"_os": runtime.GOOS,
111111
"_platform": runtime.GOARCH,
112112
"_runtime_version": runtime.Version(),
113113
}
114+
if buildInfo, ok := debug.ReadBuildInfo(); ok {
115+
for _, bi := range buildInfo.Deps {
116+
if bi.Path == "github.com/go-mysql-org/go-mysql" {
117+
c.attributes["_client_version"] = bi.Version
118+
break
119+
}
120+
}
121+
}
114122

115123
if network == "" {
116124
network = getNetProto(addr)

0 commit comments

Comments
 (0)