Skip to content

Commit bfedabb

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 7d03609 + b567287 commit bfedabb

File tree

9 files changed

+61
-52
lines changed

9 files changed

+61
-52
lines changed

.github/workflows/ci.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
name: lint
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/setup-go@v3
12+
- uses: actions/setup-go@v5
1313
with:
14-
go-version: "1.20.x"
15-
- uses: actions/checkout@v3
14+
go-version: "1.21.x"
15+
- uses: actions/checkout@v4
1616
- name: golangci-lint
1717
uses: golangci/golangci-lint-action@v3
1818
with:
@@ -22,11 +22,11 @@ jobs:
2222
runs-on: ubuntu-latest
2323
strategy:
2424
matrix:
25-
go: ["1.19.x", "1.20.x"]
25+
go: ["1.20.x", "1.21.x"]
2626
steps:
27-
- uses: actions/checkout@v3
27+
- uses: actions/checkout@v4
2828

29-
- uses: actions/setup-go@v3
29+
- uses: actions/setup-go@v5
3030
with:
3131
go-version: ${{ matrix.go }}
3232

@@ -60,27 +60,27 @@ jobs:
6060
# 3. When the workflow is triggered by a tag with `v` prefix
6161
if: ${{ success() && github.repository == 'golang-migrate/migrate' && startsWith(github.ref, 'refs/tags/v') }}
6262
steps:
63-
- uses: actions/checkout@v3
63+
- uses: actions/checkout@v4
6464
with:
6565
fetch-depth: 0
6666
- uses: ruby/setup-ruby@v1
6767
with:
6868
ruby-version: 2.7
69-
- uses: actions/setup-go@v3
69+
- uses: actions/setup-go@v5
7070
with:
71-
go-version: "1.19.x"
71+
go-version: "1.21.x"
7272

73-
- uses: docker/setup-qemu-action@v1
74-
- uses: docker/setup-buildx-action@v1
75-
- uses: docker/login-action@v1
73+
- uses: docker/setup-qemu-action@v3
74+
- uses: docker/setup-buildx-action@v3
75+
- uses: docker/login-action@v3
7676
with:
7777
username: golangmigrate
7878
password: ${{ secrets.DOCKERHUB_TOKEN }}
7979

8080
- run: echo "SOURCE=$(make echo-source)" >> $GITHUB_ENV
8181
- run: echo "DATABASE=$(make echo-database)" >> $GITHUB_ENV
8282

83-
- uses: goreleaser/goreleaser-action@v2
83+
- uses: goreleaser/goreleaser-action@v5
8484
with:
8585
version: latest
8686
args: release --rm-dist

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.20-alpine3.18 AS builder
1+
FROM golang:1.21-alpine3.19 AS builder
22
ARG VERSION
33

44
RUN apk add --no-cache git gcc musl-dev make
@@ -15,7 +15,7 @@ COPY . ./
1515

1616
RUN make build-docker
1717

18-
FROM alpine:3.18
18+
FROM alpine:3.19
1919

2020
RUN apk add --no-cache ca-certificates
2121

Dockerfile.github-actions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.18
1+
FROM alpine:3.19
22

33
RUN apk add --no-cache ca-certificates
44

FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
and whenever we want, not just once at the beginning of all tests.
5151

5252
#### Can I maintain my driver in my own repository?
53-
Yes, technically thats possible. We want to encourage you to contribute your driver to this respository though.
53+
Yes, technically thats possible. We want to encourage you to contribute your driver to this repository though.
5454
The driver's functionality is dictated by migrate's interfaces. That means there should really
5555
just be one driver for a database/ source. We want to prevent a future where several drivers doing the exact same thing,
5656
just implemented a bit differently, co-exist somewhere on GitHub. If users have to do research first to find the

GETTING_STARTED.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ migrate -database YOUR_DATABASE_URL -path PATH_TO_YOUR_MIGRATIONS up
2828

2929
Just add the code to your app and you're ready to go!
3030

31-
Before commiting your migrations you should run your migrations up, down, and then up again to see if migrations are working properly both ways.
31+
Before committing your migrations you should run your migrations up, down, and then up again to see if migrations are working properly both ways.
3232
(e.g. if you created a table in a migration but reverse migration did not delete it, you will encounter an error when running the forward migration again)
3333
It's also worth checking your migrations in a separate, containerized environment. You can find some tools at the [end of this document](#further-reading).
3434

database/parse_test.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ import (
88
)
99

1010
const reservedChars = "!#$%&'()*+,/:;=?@[]"
11+
const reservedCharTestNamePrefix = "reserved char "
1112

1213
const baseUsername = "username"
1314

15+
const scheme = "database://"
16+
1417
// TestUserUnencodedReservedURLChars documents the behavior of using unencoded reserved characters in usernames with
1518
// net/url Parse()
1619
func TestUserUnencodedReservedURLChars(t *testing.T) {
17-
scheme := "database://"
1820
urlSuffix := "password@localhost:12345/myDB?someParam=true"
1921
urlSuffixAndSep := ":" + urlSuffix
2022

@@ -64,7 +66,7 @@ func TestUserUnencodedReservedURLChars(t *testing.T) {
6466
testedChars := make([]string, 0, len(reservedChars))
6567
for _, tc := range testcases {
6668
testedChars = append(testedChars, tc.char)
67-
t.Run("reserved char "+tc.char, func(t *testing.T) {
69+
t.Run(reservedCharTestNamePrefix+tc.char, func(t *testing.T) {
6870
s := scheme + baseUsername + tc.char + urlSuffixAndSep
6971
u, err := url.Parse(s)
7072
if err == nil {
@@ -98,13 +100,12 @@ func TestUserUnencodedReservedURLChars(t *testing.T) {
98100
}
99101

100102
func TestUserEncodedReservedURLChars(t *testing.T) {
101-
scheme := "database://"
102103
urlSuffix := "password@localhost:12345/myDB?someParam=true"
103104
urlSuffixAndSep := ":" + urlSuffix
104105

105106
for _, c := range reservedChars {
106107
c := string(c)
107-
t.Run("reserved char "+c, func(t *testing.T) {
108+
t.Run(reservedCharTestNamePrefix+c, func(t *testing.T) {
108109
encodedChar := "%" + hex.EncodeToString([]byte(c))
109110
s := scheme + baseUsername + encodedChar + urlSuffixAndSep
110111
expectedUsername := baseUsername + c
@@ -126,7 +127,7 @@ func TestUserEncodedReservedURLChars(t *testing.T) {
126127
// with net/url Parse()
127128
func TestPasswordUnencodedReservedURLChars(t *testing.T) {
128129
username := baseUsername
129-
schemeAndUsernameAndSep := "database://" + username + ":"
130+
schemeAndUsernameAndSep := scheme + username + ":"
130131
basePassword := "password"
131132
urlSuffixAndSep := "@localhost:12345/myDB?someParam=true"
132133

@@ -174,7 +175,7 @@ func TestPasswordUnencodedReservedURLChars(t *testing.T) {
174175
testedChars := make([]string, 0, len(reservedChars))
175176
for _, tc := range testcases {
176177
testedChars = append(testedChars, tc.char)
177-
t.Run("reserved char "+tc.char, func(t *testing.T) {
178+
t.Run(reservedCharTestNamePrefix+tc.char, func(t *testing.T) {
178179
s := schemeAndUsernameAndSep + basePassword + tc.char + urlSuffixAndSep
179180
u, err := url.Parse(s)
180181
if err == nil {
@@ -213,13 +214,13 @@ func TestPasswordUnencodedReservedURLChars(t *testing.T) {
213214

214215
func TestPasswordEncodedReservedURLChars(t *testing.T) {
215216
username := baseUsername
216-
schemeAndUsernameAndSep := "database://" + username + ":"
217+
schemeAndUsernameAndSep := scheme + username + ":"
217218
basePassword := "password"
218219
urlSuffixAndSep := "@localhost:12345/myDB?someParam=true"
219220

220221
for _, c := range reservedChars {
221222
c := string(c)
222-
t.Run("reserved char "+c, func(t *testing.T) {
223+
t.Run(reservedCharTestNamePrefix+c, func(t *testing.T) {
223224
encodedChar := "%" + hex.EncodeToString([]byte(c))
224225
s := schemeAndUsernameAndSep + basePassword + encodedChar + urlSuffixAndSep
225226
expectedPassword := basePassword + c

go.mod

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ require (
88
github.com/aws/aws-sdk-go v1.34.0
99
github.com/cenkalti/backoff/v4 v4.1.2
1010
github.com/cockroachdb/cockroach-go/v2 v2.1.1
11-
github.com/dhui/dktest v0.3.16
12-
github.com/docker/docker v20.10.24+incompatible
11+
github.com/dhui/dktest v0.4.0
12+
github.com/docker/docker v24.0.7+incompatible
1313
github.com/docker/go-connections v0.4.0
1414
github.com/fsouza/fake-gcs-server v1.17.0
1515
github.com/go-sql-driver/mysql v1.5.0
@@ -152,14 +152,14 @@ require (
152152
github.com/zeebo/xxh3 v1.0.2 // indirect
153153
gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b // indirect
154154
go.opencensus.io v0.24.0 // indirect
155-
golang.org/x/crypto v0.9.0 // indirect
155+
golang.org/x/crypto v0.14.0 // indirect
156156
golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 // indirect
157157
golang.org/x/mod v0.10.0 // indirect
158-
golang.org/x/net v0.10.0 // indirect
158+
golang.org/x/net v0.17.0 // indirect
159159
golang.org/x/sync v0.2.0 // indirect
160-
golang.org/x/sys v0.8.0 // indirect
161-
golang.org/x/term v0.8.0 // indirect
162-
golang.org/x/text v0.9.0 // indirect
160+
golang.org/x/sys v0.13.0 // indirect
161+
golang.org/x/term v0.13.0 // indirect
162+
golang.org/x/text v0.13.0 // indirect
163163
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
164164
google.golang.org/appengine v1.6.7 // indirect
165165
google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect

go.sum

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,15 @@ github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnG
161161
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
162162
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
163163
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
164-
github.com/dhui/dktest v0.3.16 h1:i6gq2YQEtcrjKbeJpBkWjE8MmLZPYllcjOFbTZuPDnw=
165-
github.com/dhui/dktest v0.3.16/go.mod h1:gYaA3LRmM8Z4vJl2MA0THIigJoZrwOansEOsp+kqxp0=
164+
github.com/dhui/dktest v0.4.0 h1:z05UmuXZHO/bgj/ds2bGMBu8FI4WA+Ag/m3ghL+om7M=
165+
github.com/dhui/dktest v0.4.0/go.mod h1:v/Dbz1LgCBOi2Uki2nUqLBGa83hWBGFMu5MrgMDCc78=
166166
github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko=
167167
github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
168168
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
169169
github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8=
170170
github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
171-
github.com/docker/docker v20.10.24+incompatible h1:Ugvxm7a8+Gz6vqQYQQ2W7GYq5EUPaAiuPgIfVyI3dYE=
172-
github.com/docker/docker v20.10.24+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
171+
github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM=
172+
github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
173173
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
174174
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
175175
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
@@ -540,7 +540,6 @@ github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR
540540
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
541541
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
542542
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
543-
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
544543
github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y=
545544
github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
546545
github.com/snowflakedb/gosnowflake v1.6.19 h1:KSHXrQ5o7uso25hNIzi/RObXtnSGkFgie91X82KcvMY=
@@ -628,8 +627,8 @@ golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0
628627
golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
629628
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
630629
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
631-
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
632-
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
630+
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
631+
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
633632
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
634633
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
635634
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -657,6 +656,7 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB
657656
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
658657
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
659658
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
659+
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
660660
golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=
661661
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
662662
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -691,9 +691,9 @@ golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su
691691
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
692692
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
693693
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
694-
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
695-
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
696694
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
695+
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
696+
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
697697
golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
698698
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
699699
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@@ -711,6 +711,7 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
711711
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
712712
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
713713
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
714+
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
714715
golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=
715716
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
716717
golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -756,14 +757,16 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc
756757
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
757758
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
758759
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
759-
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
760760
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
761+
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
762+
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
761763
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
762764
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
763765
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
764766
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
765-
golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols=
766767
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
768+
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
769+
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
767770
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
768771
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
769772
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -775,8 +778,9 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
775778
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
776779
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
777780
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
778-
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
779781
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
782+
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
783+
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
780784
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
781785
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
782786
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 h1:M73Iuj3xbbb9Uk1DYhzydthsj6oOd6l9bpuFcNoUvTs=
@@ -815,6 +819,7 @@ golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4f
815819
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
816820
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
817821
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
822+
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
818823
golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo=
819824
golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
820825
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -915,6 +920,7 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
915920
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
916921
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
917922
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
923+
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
918924
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
919925
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
920926
gorm.io/driver/postgres v1.0.8/go.mod h1:4eOzrI1MUfm6ObJU/UcmbXyiHSs8jSwH95G5P5dxcAg=

source/file/file_test.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
st "github.com/golang-migrate/migrate/v4/source/testing"
1212
)
1313

14+
const scheme = "file://"
15+
1416
func Test(t *testing.T) {
1517
tmpDir := t.TempDir()
1618

@@ -29,7 +31,7 @@ func Test(t *testing.T) {
2931
mustWriteFile(t, tmpDir, "7_foobar.down.sql", "7 down")
3032

3133
f := &File{}
32-
d, err := f.Open("file://" + tmpDir)
34+
d, err := f.Open(scheme + tmpDir)
3335
if err != nil {
3436
t.Fatal(err)
3537
}
@@ -48,7 +50,7 @@ func TestOpen(t *testing.T) {
4850
}
4951

5052
f := &File{}
51-
_, err := f.Open("file://" + tmpDir) // absolute path
53+
_, err := f.Open(scheme + tmpDir) // absolute path
5254
if err != nil {
5355
t.Fatal(err)
5456
}
@@ -108,7 +110,7 @@ func TestOpenDefaultsToCurrentDirectory(t *testing.T) {
108110
}
109111

110112
f := &File{}
111-
d, err := f.Open("file://")
113+
d, err := f.Open(scheme)
112114
if err != nil {
113115
t.Fatal(err)
114116
}
@@ -125,7 +127,7 @@ func TestOpenWithDuplicateVersion(t *testing.T) {
125127
mustWriteFile(t, tmpDir, "1_bar.up.sql", "") // 1 up
126128

127129
f := &File{}
128-
_, err := f.Open("file://" + tmpDir)
130+
_, err := f.Open(scheme + tmpDir)
129131
if err == nil {
130132
t.Fatal("expected err")
131133
}
@@ -135,7 +137,7 @@ func TestClose(t *testing.T) {
135137
tmpDir := t.TempDir()
136138

137139
f := &File{}
138-
d, err := f.Open("file://" + tmpDir)
140+
d, err := f.Open(scheme + tmpDir)
139141
if err != nil {
140142
t.Fatal(err)
141143
}
@@ -172,7 +174,7 @@ func BenchmarkOpen(b *testing.B) {
172174
b.ResetTimer()
173175
for n := 0; n < b.N; n++ {
174176
f := &File{}
175-
_, err := f.Open("file://" + dir)
177+
_, err := f.Open(scheme + dir)
176178
if err != nil {
177179
b.Error(err)
178180
}
@@ -188,7 +190,7 @@ func BenchmarkNext(b *testing.B) {
188190
}
189191
}()
190192
f := &File{}
191-
d, _ := f.Open("file://" + dir)
193+
d, _ := f.Open(scheme + dir)
192194
b.ResetTimer()
193195
v, err := d.First()
194196
for n := 0; n < b.N; n++ {

0 commit comments

Comments
 (0)