title: How to connect to SQL Server using Windows Auth?
body: <p>I am currently using this example to connect to SQL Server using Go:</p>
  
  <p><a href="https://sqlchoice.azurewebsites.net/en-us/sql-server/developer-get-started/go/rhel/step/2.html" rel="noreferrer">Create Go apps</a></p>
  
  <p>Here is the example I am using:</p>
  
  <pre><code>    package main
  
      import (
          _ "github.com/denisenkom/go-mssqldb"
          "database/sql"
          "context"
          "log"
          "fmt"
      )
  
      // Replace with your own connection parameters
      var server = "localhost"
      var port = 1433
      var user = "sa"
      var password = "your_password"
  
      var db *sql.DB
  
      func main() {
          var err error
  
          // Create connection string
          connString := fmt.Sprintf("server=%s;user id=%s;password=%s;port=%d",
              server, user, password, port)
  
          // Create connection pool
          db, err = sql.Open("sqlserver", connString)
          if err != nil {
              log.Fatal("Error creating connection pool: " + err.Error())
          }
          log.Printf("Connected!\n")
  
          // Close the database connection pool after program executes
          defer db.Close()
  
          SelectVersion()
      }
  </code></pre>
  
  <p>Is there any known way to use Windows Authentication to connect to SQL Server?  I have tried adding "Trusted_Connection=yes" and removing the username/password.</p>
  
  <p>I have Googled around but have not found any Go Packages that have this option.</p>