You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
spuria@fedora:~/dev/SyncHisterical$ go run sync.go
# github.com/denisenkom/go-mssqldb
../../go/pkg/mod/github.com/denisenkom/go-mssqldb@v0.12.1/token.go:790:79: cannot use info.Message (variable of type Message) as type string in struct literal
To Reproduce
This happened on 2 different linux boxes (fedora 32 and debian 11) with go 1.18.2 installed following the official instructions on https://go.dev/doc/install
I created a sample project:
spuria@fedora:~/dev$ mkdir SyncHisterical
spuria@fedora:~/dev$ cd SyncHisterical/
spuria@fedora:~/dev/SyncHisterical$ go mod init ffit/syncHisterical
go: creating new go.mod: module ffit/syncHisterical
spuria@fedora:~/dev/SyncHisterical$ vim sync.go
spuria@fedora:~/dev/SyncHisterical$ go mod tidy
go: finding module for package github.com/denisenkom/go-mssqldb
go: downloading github.com/denisenkom/go-mssqldb v0.12.1
go: found github.com/denisenkom/go-mssqldb in github.com/denisenkom/go-mssqldb v0.12.1
go: downloading github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe
go: downloading github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188
go: downloading golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
spuria@fedora:~/dev/SyncHisterical$ cat go.mod
module ffit/syncHisterical
go 1.18
require github.com/denisenkom/go-mssqldb v0.12.1
require (
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect
github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188 // indirect
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect
)
spuria@fedora:~/dev/SyncHisterical$ go run sync.go
# github.com/denisenkom/go-mssqldb
../../go/pkg/mod/github.com/denisenkom/go-mssqldb@v0.12.1/token.go:790:79: cannot use info.Message (variable of type Message) as type string in struct literal
spuria@fedora:~/dev/SyncHisterical$
the code in sync.go:
import (
"context"
"database/sql"
"errors"
"fmt"
"log"
_ "github.com/denisenkom/go-mssqldb"
)
var db *sql.DB
var server = "<your_server.database.windows.net>"
var port = 1433
var user = "<your_username>"
var password = "<your_password>"
var database = "<your_database>"
func main() {
// Build connection string
connString := fmt.Sprintf("server=%s;user id=%s;password=%s;port=%d;database=%s;",
server, user, password, port, database)
var err error
// Create connection pool
db, err = sql.Open("sqlserver", connString)
if err != nil {
log.Fatal("Error creating connection pool: ", err.Error())
}
ctx := context.Background()
err = db.PingContext(ctx)
if err != nil {
log.Fatal(err.Error())
}
fmt.Printf("Connected!\n")
}
I commented out line by line and tried to run the code but the only way to not have this message was to comment out the import, even a main function with a single fmt.Printf gave that error, when commenting the import the main function was run.
Describe the bug
importing go-mssqldb results in:
To Reproduce
This happened on 2 different linux boxes (fedora 32 and debian 11) with go 1.18.2 installed following the official instructions on https://go.dev/doc/install
I created a sample project:
the code in sync.go:
I commented out line by line and tried to run the code but the only way to not have this message was to comment out the import, even a main function with a single fmt.Printf gave that error, when commenting the import the main function was run.
Expected behavior
To run the main function
Further technical details
Operating system: Debian 11, Fedora 32
Additional context
the code was taken from the example on microsoft documentation about sql server and go: https://docs.microsoft.com/it-it/azure/azure-sql/database/connect-query-go?view=azuresql
The text was updated successfully, but these errors were encountered: