golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.34k stars 17.7k forks source link

database/sql: blank driver name #44467

Open mehmetcantas opened 3 years ago

mehmetcantas commented 3 years ago

What version of Go are you using (go version)?

$ go version
 1.16

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Windows amd64

go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Can\AppData\Local\go-build
set GOENV=C:\Users\Can\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\Can\go\pkg\mod
set GONOPROXY=github.com/mehmetcantas
set GONOSUMDB=github.com/mehmetcantas
set GOOS=windows
set GOPATH=C:\Users\Can\go
set GOPRIVATE=github.com/mehmetcantas
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.16
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\Can\AppData\Local\Temp\go-build2416388004=/tmp/go-build -gno-record-gcc-switches

What did you do?

I can pass empty string as name to database/sql/driver Register function.

What did you expect to see?

While creating a new driver for database/sql package, in the Register function name parameter should not be blank.

What did you see instead?

It's accept empty name for driver.

gopherbot commented 3 years ago

Change https://golang.org/cl/294809 mentions this issue: database/sql: add empty driver name check on Register method