Apply `gofmt -s`

And add CI check for that.
pull/1490/head
Alexey Palazhchenko 2023-01-24 10:59:20 +04:00 committed by Jack Christensen
parent f581584148
commit f839d501a7
8 changed files with 69 additions and 63 deletions

View File

@ -75,7 +75,7 @@ jobs:
steps:
- name: Set up Go 1.x
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
@ -104,6 +104,12 @@ jobs:
# PGX_SSL_PASSWORD: ${{ matrix.pgx-ssl-password }}
# PGX_TEST_TLS_CLIENT_CONN_STRING: ${{ matrix.pgx-test-tls-client-conn-string }}
- name: Check formatting
run: |
gofmt -l -s -w .
git status
git diff --exit-code
- name: Test
run: go test -race ./...
env:

View File

@ -23,7 +23,7 @@ func TestScript(t *testing.T) {
script.Steps = append(script.Steps, pgmock.ExpectMessage(&pgproto3.Query{String: "select 42"}))
script.Steps = append(script.Steps, pgmock.SendMessage(&pgproto3.RowDescription{
Fields: []pgproto3.FieldDescription{
pgproto3.FieldDescription{
{
Name: []byte("?column?"),
TableOID: 0,
TableAttributeNumber: 0,

View File

@ -77,7 +77,7 @@ func TestParseConfig(t *testing.T) {
},
RuntimeParams: map[string]string{},
Fallbacks: []*pgconn.FallbackConfig{
&pgconn.FallbackConfig{
{
Host: "localhost",
Port: 5432,
TLSConfig: nil,
@ -110,7 +110,7 @@ func TestParseConfig(t *testing.T) {
TLSConfig: nil,
RuntimeParams: map[string]string{},
Fallbacks: []*pgconn.FallbackConfig{
&pgconn.FallbackConfig{
{
Host: "localhost",
Port: 5432,
TLSConfig: &tls.Config{
@ -137,7 +137,7 @@ func TestParseConfig(t *testing.T) {
},
RuntimeParams: map[string]string{},
Fallbacks: []*pgconn.FallbackConfig{
&pgconn.FallbackConfig{
{
Host: "localhost",
Port: 5432,
TLSConfig: nil,
@ -431,12 +431,12 @@ func TestParseConfig(t *testing.T) {
TLSConfig: nil,
RuntimeParams: map[string]string{},
Fallbacks: []*pgconn.FallbackConfig{
&pgconn.FallbackConfig{
{
Host: "bar",
Port: defaultPort,
TLSConfig: nil,
},
&pgconn.FallbackConfig{
{
Host: "baz",
Port: defaultPort,
TLSConfig: nil,
@ -456,12 +456,12 @@ func TestParseConfig(t *testing.T) {
TLSConfig: nil,
RuntimeParams: map[string]string{},
Fallbacks: []*pgconn.FallbackConfig{
&pgconn.FallbackConfig{
{
Host: "bar",
Port: 2,
TLSConfig: nil,
},
&pgconn.FallbackConfig{
{
Host: "baz",
Port: 3,
TLSConfig: nil,
@ -495,12 +495,12 @@ func TestParseConfig(t *testing.T) {
TLSConfig: nil,
RuntimeParams: map[string]string{},
Fallbacks: []*pgconn.FallbackConfig{
&pgconn.FallbackConfig{
{
Host: "bar",
Port: 5432,
TLSConfig: nil,
},
&pgconn.FallbackConfig{
{
Host: "baz",
Port: 5432,
TLSConfig: nil,
@ -520,12 +520,12 @@ func TestParseConfig(t *testing.T) {
TLSConfig: nil,
RuntimeParams: map[string]string{},
Fallbacks: []*pgconn.FallbackConfig{
&pgconn.FallbackConfig{
{
Host: "bar",
Port: 2,
TLSConfig: nil,
},
&pgconn.FallbackConfig{
{
Host: "baz",
Port: 3,
TLSConfig: nil,
@ -548,31 +548,31 @@ func TestParseConfig(t *testing.T) {
},
RuntimeParams: map[string]string{},
Fallbacks: []*pgconn.FallbackConfig{
&pgconn.FallbackConfig{
{
Host: "foo",
Port: defaultPort,
TLSConfig: nil,
},
&pgconn.FallbackConfig{
{
Host: "bar",
Port: defaultPort,
TLSConfig: &tls.Config{
InsecureSkipVerify: true,
ServerName: "bar",
}},
&pgconn.FallbackConfig{
{
Host: "bar",
Port: defaultPort,
TLSConfig: nil,
},
&pgconn.FallbackConfig{
{
Host: "baz",
Port: defaultPort,
TLSConfig: &tls.Config{
InsecureSkipVerify: true,
ServerName: "baz",
}},
&pgconn.FallbackConfig{
{
Host: "baz",
Port: defaultPort,
TLSConfig: nil,
@ -957,7 +957,7 @@ func TestParseConfigEnvLibpq(t *testing.T) {
},
RuntimeParams: map[string]string{},
Fallbacks: []*pgconn.FallbackConfig{
&pgconn.FallbackConfig{
{
Host: "123.123.123.123",
Port: 5432,
TLSConfig: nil,
@ -1101,7 +1101,7 @@ application_name = spaced string
},
RuntimeParams: map[string]string{},
Fallbacks: []*pgconn.FallbackConfig{
&pgconn.FallbackConfig{
{
Host: "abc.example.com",
Port: 9999,
TLSConfig: nil,
@ -1123,7 +1123,7 @@ application_name = spaced string
},
RuntimeParams: map[string]string{"application_name": "spaced string"},
Fallbacks: []*pgconn.FallbackConfig{
&pgconn.FallbackConfig{
{
Host: "def.example.com",
Port: defaultPort,
TLSConfig: nil,

View File

@ -468,7 +468,7 @@ func TestConnectWithFallback(t *testing.T) {
// Prepend current primary config to fallbacks
config.Fallbacks = append([]*pgconn.FallbackConfig{
&pgconn.FallbackConfig{
{
Host: config.Host,
Port: config.Port,
TLSConfig: config.TLSConfig,
@ -481,7 +481,7 @@ func TestConnectWithFallback(t *testing.T) {
// Prepend bad first fallback
config.Fallbacks = append([]*pgconn.FallbackConfig{
&pgconn.FallbackConfig{
{
Host: "localhost",
Port: 1,
TLSConfig: config.TLSConfig,

View File

@ -46,7 +46,7 @@
// // handle error that occurred while using *pgx.Conn
// }
//
// PostgreSQL Specific Data Types
// # PostgreSQL Specific Data Types
//
// The pgtype package provides support for PostgreSQL specific types. *pgtype.Map.SQLScanner is an adapter that makes
// these types usable as a sql.Scanner.
@ -140,7 +140,7 @@ func RandomizeHostOrderFunc(ctx context.Context, connConfig *pgx.ConnConfig) err
return nil
}
newFallbacks := append([]*pgconn.FallbackConfig{&pgconn.FallbackConfig{
newFallbacks := append([]*pgconn.FallbackConfig{{
Host: connConfig.Host,
Port: connConfig.Port,
TLSConfig: connConfig.TLSConfig,

View File

@ -1105,9 +1105,9 @@ func TestRandomizeHostOrderFunc(t *testing.T) {
// Test that at some point we connect to all 3 hosts
hostsNotSeenYet := map[string]struct{}{
"host1": struct{}{},
"host2": struct{}{},
"host3": struct{}{},
"host1": {},
"host2": {},
"host3": {},
}
// If we don't succeed within this many iterations, something is certainly wrong