Skip to content
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

Allow to change (or disable) the default driver name for registration #1499

Commits on Oct 16, 2023

  1. Allow to change (or disable) the default driver name for registration

    A link variable now allows to change or disable the name of the driver
    that is automatically registered with database/sql:
    
    Change driver name:
        go build "-ldflags=-X github.com/go-sql-driver/mysql.driverName=custom"
    
    Disable driver registration (set driverName to empty string):
        go build "-ldflags=-X github.com/go-sql-driver/mysql.driverName="
    
    In the same way, a variable overridable at link time is also provided to
    override the driver name used in the test suite. This allows to run our
    test suite on another driver.
    
        go test "-ldflags=-X github.com/go-sql-driver/mysql.driverNameTest=custom"
    
    driverName is propagated to driverNameTest unless driverNameTest is
    explicitely defined.
    dolmen committed Oct 16, 2023
    Configuration menu
    Copy the full SHA
    e59ef51 View commit details
    Browse the repository at this point in the history