Skip to content

Commit cc2726c

Browse files
refactor: revert unnecessary formatting changes
Keep only the go.mod replace directive change. Remove formatting changes to other files as they are unrelated to the vendoring fix. Co-authored-by: dlevy-msft-sql <194277063+dlevy-msft-sql@users.noreply.github.com>
1 parent 1482825 commit cc2726c

File tree

5 files changed

+33
-34
lines changed

5 files changed

+33
-34
lines changed

examples/channel_binding/tsql.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ import (
1414

1515
"github.com/google/uuid"
1616
mssqldb "github.com/microsoft/go-mssqldb"
17-
_ "github.com/microsoft/go-mssqldb/integratedauth/krb5"
1817
"github.com/microsoft/go-mssqldb/msdsn"
18+
_ "github.com/microsoft/go-mssqldb/integratedauth/krb5"
1919
)
2020

2121
func main() {
2222
var (
23-
userid = flag.String("U", "", "login_id")
24-
password = flag.String("P", "", "password")
25-
server = flag.String("S", "localhost", "server_name[\\instance_name]")
26-
port = flag.Uint64("p", 1433, "server port")
27-
keyLog = flag.String("K", "tlslog.log", "path to sslkeylog file")
28-
database = flag.String("d", "", "db_name")
29-
spn = flag.String("spn", "", "SPN")
30-
auth = flag.String("a", "ntlm", "Authentication method: ntlm, krb5 or winsspi")
31-
epa = flag.Bool("epa", true, "EPA enabled: true, false")
32-
encrypt = flag.String("e", "required", "encrypt mode: required, disabled, strict, optional")
33-
query = flag.String("q", "", "query to execute")
23+
userid = flag.String("U", "", "login_id")
24+
password = flag.String("P", "", "password")
25+
server = flag.String("S", "localhost", "server_name[\\instance_name]")
26+
port = flag.Uint64("p", 1433, "server port")
27+
keyLog = flag.String("K", "tlslog.log", "path to sslkeylog file")
28+
database = flag.String("d", "", "db_name")
29+
spn = flag.String("spn", "", "SPN")
30+
auth = flag.String("a", "ntlm", "Authentication method: ntlm, krb5 or winsspi")
31+
epa = flag.Bool("epa", true, "EPA enabled: true, false")
32+
encrypt = flag.String("e", "required", "encrypt mode: required, disabled, strict, optional")
33+
query = flag.String("q", "", "query to execute")
3434
tlsMinVersion = flag.String("tlsmin", "1.1", "TLS minimum version: 1.0, 1.1, 1.2, 1.3")
3535
tlsMaxVersion = flag.String("tlsmax", "1.3", "TLS maximum version: 1.0, 1.1, 1.2, 1.3")
3636
)
@@ -61,7 +61,7 @@ func main() {
6161
Password: *password,
6262
ChangePassword: "",
6363
AppName: "go-mssqldb",
64-
ServerSPN: *spn,
64+
ServerSPN: *spn,
6565
TLSConfig: &tls.Config{
6666
InsecureSkipVerify: true, // adjust for your case
6767
ServerName: *server,
@@ -70,11 +70,11 @@ func main() {
7070
MinVersion: tlsMinVersionNum,
7171
MaxVersion: tlsMaxVersionNum,
7272
},
73-
Encryption: encryption,
73+
Encryption: encryption,
7474
Parameters: map[string]string{
75-
"authenticator": *auth,
75+
"authenticator": *auth,
7676
"krb5-credcachefile": os.Getenv("KRB5_CCNAME"),
77-
"krb5-configfile": os.Getenv("KRB5_CONFIG"),
77+
"krb5-configfile": os.Getenv("KRB5_CONFIG"),
7878
},
7979
ProtocolParameters: map[string]interface{}{},
8080
Protocols: []string{
@@ -87,7 +87,7 @@ func main() {
8787
DialTimeout: time.Second * 5,
8888
ConnTimeout: time.Second * 10,
8989
KeepAlive: time.Second * 30,
90-
EpaEnabled: *epa,
90+
EpaEnabled: *epa,
9191
}
9292

9393
activityid, uerr := uuid.NewRandom()
@@ -116,7 +116,7 @@ func main() {
116116
fmt.Println("Cannot connect: ", err.Error())
117117
return
118118
}
119-
119+
120120
if *query != "" {
121121
err = exec(db, *query)
122122
if err != nil {
@@ -222,4 +222,4 @@ func parseEncrypt(encrypt string) (msdsn.Encryption, error) {
222222
default:
223223
return msdsn.EncryptionOff, fmt.Errorf("invalid encrypt '%s'", encrypt)
224224
}
225-
}
225+
}

integratedauth/auth_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ type stubAuth struct {
1414
user string
1515
}
1616

17-
func (s *stubAuth) InitialBytes() ([]byte, error) { return nil, nil }
18-
func (s *stubAuth) NextBytes([]byte) ([]byte, error) { return nil, nil }
19-
func (s *stubAuth) Free() {}
20-
func (s *stubAuth) SetChannelBinding(*ChannelBindings) {}
17+
func (s *stubAuth) InitialBytes() ([]byte, error) { return nil, nil }
18+
func (s *stubAuth) NextBytes([]byte) ([]byte, error) { return nil, nil }
19+
func (s *stubAuth) Free() {}
20+
func (s *stubAuth) SetChannelBinding(*ChannelBindings) {}
2121

2222
func getAuth(config msdsn.Config) (IntegratedAuthenticator, error) {
2323
return &stubAuth{config.User}, nil

integratedauth/channel_binding.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ type AuthenticatorWithEPA interface {
1414
}
1515

1616
type ChannelBindingsType uint32
17-
1817
const (
19-
ChannelBindingsTypeTLSExporter = 0
20-
ChannelBindingsTypeTLSUnique = 1
18+
ChannelBindingsTypeTLSExporter = 0
19+
ChannelBindingsTypeTLSUnique = 1
2120
ChannelBindingsTypeTLSServerEndPoint = 2
22-
ChannelBindingsTypeEmpty = 3
21+
ChannelBindingsTypeEmpty = 3
2322
)
2423

2524
const (
@@ -35,7 +34,7 @@ const (
3534
// gss_channel_bindings_struct: https://docs.oracle.com/cd/E19683-01/816-1331/overview-52/index.html
3635
// gss_buffer_desc: https://docs.oracle.com/cd/E19683-01/816-1331/reference-21/index.html
3736
type ChannelBindings struct {
38-
Type ChannelBindingsType
37+
Type ChannelBindingsType
3938
InitiatorAddrType uint32
4039
InitiatorAddress []byte
4140
AcceptorAddrType uint32
@@ -57,7 +56,7 @@ type SEC_CHANNEL_BINDINGS struct {
5756
}
5857

5958
var EmptyChannelBindings = &ChannelBindings{
60-
Type: ChannelBindingsTypeEmpty,
59+
Type: ChannelBindingsTypeEmpty,
6160
InitiatorAddrType: 0,
6261
InitiatorAddress: nil,
6362
AcceptorAddrType: 0,
@@ -176,7 +175,7 @@ func GenerateCBTFromTLSUnique(tlsUnique []byte) (*ChannelBindings, error) {
176175
return nil, fmt.Errorf("tlsUnique is empty")
177176
}
178177
return &ChannelBindings{
179-
Type: ChannelBindingsTypeTLSUnique,
178+
Type: ChannelBindingsTypeTLSUnique,
180179
InitiatorAddrType: 0,
181180
InitiatorAddress: nil,
182181
AcceptorAddrType: 0,
@@ -213,7 +212,7 @@ func GenerateCBTFromTLSExporter(exporterKey []byte) (*ChannelBindings, error) {
213212
}
214213

215214
return &ChannelBindings{
216-
Type: ChannelBindingsTypeTLSExporter,
215+
Type: ChannelBindingsTypeTLSExporter,
217216
InitiatorAddrType: 0,
218217
InitiatorAddress: nil,
219218
AcceptorAddrType: 0,
@@ -248,7 +247,7 @@ func GenerateCBTFromServerCert(cert *x509.Certificate) *ChannelBindings {
248247
_, _ = h.Write(cert.Raw)
249248
certHash = h.Sum(nil)
250249
return &ChannelBindings{
251-
Type: ChannelBindingsTypeTLSServerEndPoint,
250+
Type: ChannelBindingsTypeTLSServerEndPoint,
252251
InitiatorAddrType: 0,
253252
InitiatorAddress: nil,
254253
AcceptorAddrType: 0,

integratedauth/channel_binding_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ func TestAsSSPI_SEC_CHANNEL_BINDINGS(t *testing.T) {
3535
t.Errorf("Expected %s, but got %s for input %s", expected, hex.EncodeToString(winsspiCB), input)
3636
}
3737
}
38-
}
38+
}

msdsn/conn_str.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ func Parse(dsn string) (Config, error) {
647647
if !ok {
648648
epaString = os.Getenv("MSSQL_USE_EPA")
649649
}
650-
if epaString != "" {
650+
if epaString != "" {
651651
epaEnabled, err := strconv.ParseBool(epaString)
652652
if err != nil {
653653
return p, fmt.Errorf("invalid epa enabled value '%s': %v", epaString, err)

0 commit comments

Comments
 (0)