Skip to content

Commit 6dade9d

Browse files
V15 Support (#98)
* Try with updated golang set up. * Try updating to golang 1.18 * Update deprecated calls. * Use macos 11. * Fix tests. * Fix tests. * Restore versions. * Fix Circle.
1 parent baa0dbf commit 6dade9d

19 files changed

+75
-118
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- restore_cache:
1818
keys:
1919
- embedded-postgres-{{ checksum "/home/circleci/go/src/github.com/fergusstrange/embedded-postgres/go.mod" }}
20-
- run: cd platform-test && go test -v -race ./...
20+
- run: cd platform-test && go mod download && go test -v -race ./...
2121
- save_cache:
2222
key: embedded-postgres-{{ checksum "/home/circleci/go/src/github.com/fergusstrange/embedded-postgres/go.mod" }}
2323
paths:

.github/workflows/build.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
id: go
1414
uses: actions/checkout@v1
1515
- name: Set Up Golang
16-
uses: actions/setup-go@v1
16+
uses: actions/setup-go@v3
1717
with:
18-
go-version: 1.13
18+
go-version: 1.18
1919
- name: Check Dependencies
2020
run: |
2121
go list -json -deps > go.list
@@ -58,7 +58,7 @@ jobs:
5858
name: Alpine Linux Platform Tests
5959
runs-on: ubuntu-latest
6060
container:
61-
image: golang:1.13-alpine
61+
image: golang:1.18-alpine
6262
steps:
6363
- uses: actions/checkout@v1
6464
- name: Set Up
@@ -71,15 +71,15 @@ jobs:
7171
name: Platform tests
7272
strategy:
7373
matrix:
74-
os: [ ubuntu-latest, windows-latest, macos-latest ]
74+
os: [ ubuntu-latest, windows-latest, macos-11 ]
7575
runs-on: ${{ matrix.os }}
7676
steps:
7777
- name: Checkout
7878
uses: actions/checkout@v1
7979
- name: Set Up Golang
80-
uses: actions/setup-go@v1
80+
uses: actions/setup-go@v3
8181
with:
82-
go-version: 1.13
82+
go-version: 1.18
8383
- name: Platform Tests
8484
run: |
8585
cd platform-test

decompression_test.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"archive/tar"
55
"errors"
66
"io"
7-
"io/ioutil"
87
"os"
98
"path/filepath"
109
"testing"
@@ -14,7 +13,7 @@ import (
1413
)
1514

1615
func Test_decompressTarXz(t *testing.T) {
17-
tempDir, err := ioutil.TempDir("", "temp_tar_test")
16+
tempDir, err := os.MkdirTemp("", "temp_tar_test")
1817
if err != nil {
1918
panic(err)
2019
}
@@ -29,7 +28,7 @@ func Test_decompressTarXz(t *testing.T) {
2928
expectedExtractedFileLocation := filepath.Join(tempDir, "dir1", "dir2", "some_content")
3029
assert.FileExists(t, expectedExtractedFileLocation)
3130

32-
fileContentBytes, err := ioutil.ReadFile(expectedExtractedFileLocation)
31+
fileContentBytes, err := os.ReadFile(expectedExtractedFileLocation)
3332
assert.NoError(t, err)
3433

3534
assert.Equal(t, "b33r is g00d", string(fileContentBytes))
@@ -42,7 +41,7 @@ func Test_decompressTarXz_ErrorWhenFileNotExists(t *testing.T) {
4241
}
4342

4443
func Test_decompressTarXz_ErrorWhenErrorDuringRead(t *testing.T) {
45-
tempDir, err := ioutil.TempDir("", "temp_tar_test")
44+
tempDir, err := os.MkdirTemp("", "temp_tar_test")
4645
if err != nil {
4746
panic(err)
4847
}
@@ -60,7 +59,7 @@ func Test_decompressTarXz_ErrorWhenErrorDuringRead(t *testing.T) {
6059
}
6160

6261
func Test_decompressTarXz_ErrorWhenFailedToReadFileToCopy(t *testing.T) {
63-
tempDir, err := ioutil.TempDir("", "temp_tar_test")
62+
tempDir, err := os.MkdirTemp("", "temp_tar_test")
6463
if err != nil {
6564
panic(err)
6665
}
@@ -70,7 +69,7 @@ func Test_decompressTarXz_ErrorWhenFailedToReadFileToCopy(t *testing.T) {
7069

7170
blockingFile := filepath.Join(tempDir, "blocking")
7271

73-
if err = ioutil.WriteFile(blockingFile, []byte("wazz"), 0000); err != nil {
72+
if err = os.WriteFile(blockingFile, []byte("wazz"), 0000); err != nil {
7473
panic(err)
7574
}
7675

@@ -100,7 +99,7 @@ func Test_decompressTarXz_ErrorWhenFailedToReadFileToCopy(t *testing.T) {
10099
}
101100

102101
func Test_decompressTarXz_ErrorWhenFileToCopyToNotExists(t *testing.T) {
103-
tempDir, err := ioutil.TempDir("", "temp_tar_test")
102+
tempDir, err := os.MkdirTemp("", "temp_tar_test")
104103
if err != nil {
105104
panic(err)
106105
}
@@ -134,7 +133,7 @@ func Test_decompressTarXz_ErrorWhenFileToCopyToNotExists(t *testing.T) {
134133
}
135134

136135
func Test_decompressTarXz_ErrorWhenArchiveCorrupted(t *testing.T) {
137-
tempDir, err := ioutil.TempDir("", "temp_tar_test")
136+
tempDir, err := os.MkdirTemp("", "temp_tar_test")
138137
if err != nil {
139138
panic(err)
140139
}

embedded_postgres.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package embeddedpostgres
33
import (
44
"errors"
55
"fmt"
6-
"io/ioutil"
76
"net"
87
"os"
98
"os/exec"
@@ -225,7 +224,7 @@ func ensurePortAvailable(port uint32) error {
225224
func dataDirIsValid(dataDir string, version PostgresVersion) bool {
226225
pgVersion := filepath.Join(dataDir, "PG_VERSION")
227226

228-
d, err := ioutil.ReadFile(pgVersion)
227+
d, err := os.ReadFile(pgVersion)
229228
if err != nil {
230229
return false
231230
}

embedded_postgres_test.go

+11-12
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"database/sql"
55
"errors"
66
"fmt"
7-
"io/ioutil"
87
"net"
98
"os"
109
"os/user"
@@ -107,7 +106,7 @@ func Test_ErrorWhenUnableToInitDatabase(t *testing.T) {
107106
jarFile, cleanUp := createTempXzArchive()
108107
defer cleanUp()
109108

110-
extractPath, err := ioutil.TempDir(filepath.Dir(jarFile), "extract")
109+
extractPath, err := os.MkdirTemp(filepath.Dir(jarFile), "extract")
111110
if err != nil {
112111
panic(err)
113112
}
@@ -143,7 +142,7 @@ func Test_ErrorWhenUnableToCreateDatabase(t *testing.T) {
143142

144143
defer cleanUp()
145144

146-
extractPath, err := ioutil.TempDir(filepath.Dir(jarFile), "extract")
145+
extractPath, err := os.MkdirTemp(filepath.Dir(jarFile), "extract")
147146

148147
if err != nil {
149148
panic(err)
@@ -214,7 +213,7 @@ func Test_ErrorWhenCannotStartPostgresProcess(t *testing.T) {
214213

215214
defer cleanUp()
216215

217-
extractPath, err := ioutil.TempDir(filepath.Dir(jarFile), "extract")
216+
extractPath, err := os.MkdirTemp(filepath.Dir(jarFile), "extract")
218217
if err != nil {
219218
panic(err)
220219
}
@@ -236,7 +235,7 @@ func Test_ErrorWhenCannotStartPostgresProcess(t *testing.T) {
236235
}
237236

238237
func Test_CustomConfig(t *testing.T) {
239-
tempDir, err := ioutil.TempDir("", "embedded_postgres_test")
238+
tempDir, err := os.MkdirTemp("", "embedded_postgres_test")
240239
if err != nil {
241240
panic(err)
242241
}
@@ -281,7 +280,7 @@ func Test_CustomConfig(t *testing.T) {
281280
}
282281

283282
func Test_CustomLog(t *testing.T) {
284-
tempDir, err := ioutil.TempDir("", "embedded_postgres_test")
283+
tempDir, err := os.MkdirTemp("", "embedded_postgres_test")
285284
if err != nil {
286285
panic(err)
287286
}
@@ -402,7 +401,7 @@ func Test_CanStartAndStopTwice(t *testing.T) {
402401
}
403402

404403
func Test_ReuseData(t *testing.T) {
405-
tempDir, err := ioutil.TempDir("", "embedded_postgres_test")
404+
tempDir, err := os.MkdirTemp("", "embedded_postgres_test")
406405
if err != nil {
407406
panic(err)
408407
}
@@ -480,7 +479,7 @@ func Test_ReuseData(t *testing.T) {
480479
}
481480

482481
func Test_CustomBinariesRepo(t *testing.T) {
483-
tempDir, err := ioutil.TempDir("", "embedded_postgres_test")
482+
tempDir, err := os.MkdirTemp("", "embedded_postgres_test")
484483
if err != nil {
485484
panic(err)
486485
}
@@ -526,7 +525,7 @@ func Test_CustomBinariesRepo(t *testing.T) {
526525
}
527526

528527
func Test_CustomBinariesLocation(t *testing.T) {
529-
tempDir, err := ioutil.TempDir("", "prepare_database_test")
528+
tempDir, err := os.MkdirTemp("", "prepare_database_test")
530529
if err != nil {
531530
panic(err)
532531
}
@@ -564,12 +563,12 @@ func Test_CustomBinariesLocation(t *testing.T) {
564563
}
565564

566565
func Test_PrefetchedBinaries(t *testing.T) {
567-
binTempDir, err := ioutil.TempDir("", "prepare_database_test_bin")
566+
binTempDir, err := os.MkdirTemp("", "prepare_database_test_bin")
568567
if err != nil {
569568
panic(err)
570569
}
571570

572-
runtimeTempDir, err := ioutil.TempDir("", "prepare_database_test_runtime")
571+
runtimeTempDir, err := os.MkdirTemp("", "prepare_database_test_runtime")
573572
if err != nil {
574573
panic(err)
575574
}
@@ -616,7 +615,7 @@ func Test_PrefetchedBinaries(t *testing.T) {
616615
}
617616

618617
func Test_RunningInParallel(t *testing.T) {
619-
tempPath, err := ioutil.TempDir("", "parallel_tests_path")
618+
tempPath, err := os.MkdirTemp("", "parallel_tests_path")
620619
if err != nil {
621620
panic(err)
622621
}

examples/go.mod

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/fergusstrange/embedded-postgres/examples
22

3-
go 1.13
3+
go 1.18
44

55
replace github.com/fergusstrange/embedded-postgres => ../
66

@@ -11,3 +11,10 @@ require (
1111
github.com/pressly/goose/v3 v3.0.1
1212
go.uber.org/zap v1.21.0
1313
)
14+
15+
require (
16+
github.com/pkg/errors v0.9.1 // indirect
17+
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
18+
go.uber.org/atomic v1.7.0 // indirect
19+
go.uber.org/multierr v1.6.0 // indirect
20+
)

examples/go.sum

-9
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2V
1414
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
1515
github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g=
1616
github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ=
17-
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
1817
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
1918
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
20-
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
2119
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
2220
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
2321
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
@@ -48,17 +46,14 @@ go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
4846
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
4947
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
5048
go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=
51-
go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
5249
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
5350
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
5451
go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8=
5552
go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
5653
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
5754
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
5855
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
59-
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
6056
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
61-
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
6257
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
6358
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
6459
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@@ -70,22 +65,18 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
7065
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
7166
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
7267
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
73-
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
7468
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
7569
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
7670
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
7771
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
7872
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
7973
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
8074
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
81-
golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=
8275
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
8376
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
8477
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
85-
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
8678
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
8779
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
88-
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
8980
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
9081
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
9182
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

go.mod

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
module github.com/fergusstrange/embedded-postgres
22

3-
go 1.13
3+
go 1.18
44

55
require (
66
github.com/lib/pq v1.10.4
77
github.com/stretchr/testify v1.7.0
88
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8
99
go.uber.org/goleak v1.1.12
1010
)
11+
12+
require (
13+
github.com/davecgh/go-spew v1.1.0 // indirect
14+
github.com/pmezard/go-difflib v1.0.0 // indirect
15+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
16+
)

go.sum

-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
2121
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
2222
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
2323
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
24-
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
2524
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
2625
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
2726
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@@ -33,7 +32,6 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
3332
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
3433
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
3534
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
36-
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
3735
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3836
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
3937
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -45,7 +43,6 @@ golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=
4543
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
4644
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
4745
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
48-
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
4946
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
5047
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
5148
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=

logging.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package embeddedpostgres
33
import (
44
"fmt"
55
"io"
6-
"io/ioutil"
76
"os"
87
)
98

@@ -14,7 +13,7 @@ type syncedLogger struct {
1413
}
1514

1615
func newSyncedLogger(dir string, logger io.Writer) (*syncedLogger, error) {
17-
file, err := ioutil.TempFile(dir, "embedded_postgres_log")
16+
file, err := os.CreateTemp(dir, "embedded_postgres_log")
1817
if err != nil {
1918
return nil, err
2019
}

logging_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package embeddedpostgres
22

33
import (
4-
"io/ioutil"
54
"os"
65
"testing"
76

@@ -47,7 +46,7 @@ func Test_SyncedLogger_NoErrorDuringFlush(t *testing.T) {
4746

4847
assert.NoError(t, slErr)
4948

50-
err := ioutil.WriteFile(sl.file.Name(), []byte("some logs\non a new line"), os.ModeAppend)
49+
err := os.WriteFile(sl.file.Name(), []byte("some logs\non a new line"), os.ModeAppend)
5150

5251
assert.NoError(t, err)
5352

0 commit comments

Comments
 (0)