Skip to content

ignore pass Net config. #428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

Conversation

appleboy
Copy link
Contributor

Description

Example:

    connectStr := &mysql.Config {
        User: "homestead",
        Passwd: "secret",
        Addr: 127.0.0.1:33060,
        DBName: gin-jwt,
        Params: map[string]string {
            "charset": "utf8",
        },
    }

    fmt.Println(connectStr.FormatDSN())

Wrong Output: homestead:secret@/gin-jwt?charset=utf8
Expect: homestead:secret@(127.0.0.1:33060)/gin-jwt?charset=utf8

If I add Net parameter, it will output correct result but we don't need pass Net parameter for this case.

Thanks.

Checklist

  • Code compiles correctly
  • Created tests, if possible
  • All tests passing
  • Extended the README / documentation, if necessary
  • Added myself / the copyright holder to the AUTHORS file

Signed-off-by: Bo-Yi Wu [email protected]

Signed-off-by: Bo-Yi Wu <[email protected]>
Signed-off-by: Bo-Yi Wu <[email protected]>
Signed-off-by: Bo-Yi Wu <[email protected]>
@appleboy
Copy link
Contributor Author

appleboy commented Mar 1, 2016

ping @arnehormann

@arnehormann
Copy link
Member

@appleboy thanks, that's a good find.

But I don't think it's the right fix, Net must be set to use Address.
See https://github.com/go-sql-driver/mysql#dsn-data-source-name

The fields in Config should document required other fields. I'll write a PR.

@arnehormann arnehormann closed this Mar 1, 2016
@arnehormann
Copy link
Member

I just added #429

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants