Skip to content

Commit 14af9a1

Browse files
committed
with kong we don't need global vars
1 parent b234a3b commit 14af9a1

112 files changed

Lines changed: 7315 additions & 20148 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmd/s3backup/main.go

Lines changed: 220 additions & 390 deletions
Large diffs are not rendered by default.

cmd/s3backup/main_test.go

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,27 @@ import (
77
)
88

99
func TestCheckPaths(t *testing.T) {
10-
localPath = "s3://foo/bar.txt"
11-
remotePath = "s3://foo/bar.txt"
12-
assert.Error(t, checkPaths(), "cannot have two remote paths")
10+
inLocal := "s3://foo/bar.txt"
11+
inRemote := "s3://foo/bar.txt"
12+
_, _, err := checkPaths(inRemote, inLocal)
13+
assert.Error(t, err, "cannot have two remote paths")
1314

14-
localPath = "bar.txt"
15-
remotePath = "bar.txt"
16-
assert.Error(t, checkPaths(), "cannot have two local paths")
15+
inLocal = "bar.txt"
16+
inRemote = "bar.txt"
17+
_, _, err = checkPaths(inRemote, inLocal)
18+
assert.Error(t, err, "cannot have two local paths")
1719

18-
localPath = "bar.txt"
19-
remotePath = "s3://foo/bar.txt"
20-
assert.NilError(t, checkPaths())
20+
inLocal = "bar.txt"
21+
inRemote = "s3://foo/bar.txt"
22+
outRemote, outLocal, err := checkPaths(inRemote, inLocal)
23+
assert.NilError(t, err)
24+
assert.Equal(t, inLocal, outLocal)
25+
assert.Equal(t, inRemote, outRemote)
2126

22-
localPath = "s3://foo/bar.txt"
23-
remotePath = "bar.txt"
24-
assert.NilError(t, checkPaths())
25-
assert.Equal(t, "bar.txt", localPath)
26-
assert.Equal(t, "s3://foo/bar.txt", remotePath)
27+
inLocal = "s3://foo/bar.txt"
28+
inRemote = "bar.txt"
29+
outRemote, outLocal, err = checkPaths(inRemote, inLocal)
30+
assert.NilError(t, err)
31+
assert.Equal(t, inLocal, outRemote)
32+
assert.Equal(t, inRemote, outLocal)
2733
}

go.mod

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,25 @@ module github.com/tomcz/s3backup/v2
33
go 1.24
44

55
require (
6+
github.com/alecthomas/kong v1.12.1
67
github.com/aws/aws-sdk-go v1.55.7
78
github.com/go-viper/mapstructure/v2 v2.3.0
89
github.com/hashicorp/vault-client-go v0.4.3
910
github.com/johannesboyne/gofakes3 v0.0.0-20241026070602-0da3aa9c32ca
1011
github.com/matryer/moq v0.5.3
11-
github.com/urfave/cli/v2 v2.27.7
1212
gotest.tools/v3 v3.5.1
1313
)
1414

1515
require (
16-
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
1716
github.com/google/go-cmp v0.6.0 // indirect
1817
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
1918
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
2019
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
2120
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
2221
github.com/jmespath/go-jmespath v0.4.0 // indirect
2322
github.com/mitchellh/go-homedir v1.1.0 // indirect
24-
github.com/russross/blackfriday/v2 v2.1.0 // indirect
2523
github.com/ryanuber/go-glob v1.0.0 // indirect
2624
github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46 // indirect
27-
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
2825
go.shabbyrobe.org/gocovmerge v0.0.0-20230507111327-fa4f82cfbf4d // indirect
2926
golang.org/x/mod v0.23.0 // indirect
3027
golang.org/x/sync v0.11.0 // indirect

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
2+
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
3+
github.com/alecthomas/kong v1.12.1 h1:iq6aMJDcFYP9uFrLdsiZQ2ZMmcshduyGv4Pek0MQPW0=
4+
github.com/alecthomas/kong v1.12.1/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU=
5+
github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
6+
github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
17
github.com/aws/aws-sdk-go v1.44.256/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
28
github.com/aws/aws-sdk-go v1.55.7 h1:UJrkFq7es5CShfBwlWAC8DA077vp8PyVbQd3lqLiztE=
39
github.com/aws/aws-sdk-go v1.55.7/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
410
github.com/cevatbarisyilmaz/ara v0.0.4 h1:SGH10hXpBJhhTlObuZzTuFn1rrdmjQImITXnZVPSodc=
511
github.com/cevatbarisyilmaz/ara v0.0.4/go.mod h1:BfFOxnUd6Mj6xmcvRxHN3Sr21Z1T3U2MYkYOmoQe4Ts=
6-
github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo=
7-
github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
812
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
913
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1014
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -26,6 +30,8 @@ github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9
2630
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4=
2731
github.com/hashicorp/vault-client-go v0.4.3 h1:zG7STGVgn/VK6rnZc0k8PGbfv2x/sJExRKHSUg3ljWc=
2832
github.com/hashicorp/vault-client-go v0.4.3/go.mod h1:4tDw7Uhq5XOxS1fO+oMtotHL7j4sB9cp0T7U6m4FzDY=
33+
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
34+
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
2935
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
3036
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
3137
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
@@ -43,8 +49,6 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk
4349
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
4450
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4551
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
46-
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
47-
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
4852
github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=
4953
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
5054
github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46 h1:GHRpF1pTW19a8tTFrMLUcfWwyC0pnifVo2ClaLq+hP8=
@@ -54,10 +58,6 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
5458
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
5559
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
5660
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
57-
github.com/urfave/cli/v2 v2.27.7 h1:bH59vdhbjLv3LAvIu6gd0usJHgoTTPhCFib8qqOwXYU=
58-
github.com/urfave/cli/v2 v2.27.7/go.mod h1:CyNAG/xg+iAOg0N4MPGZqVmv2rCoP267496AOXUZjA4=
59-
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
60-
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
6161
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
6262
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
6363
go.shabbyrobe.org/gocovmerge v0.0.0-20230507111327-fa4f82cfbf4d h1:Ns9kd1Rwzw7t0BR8XMphenji4SmIoNZPn8zhYmaVKP8=

vendor/github.com/alecthomas/kong/.gitignore

Whitespace-only changes.

vendor/github.com/alecthomas/kong/.golangci.yml

Lines changed: 85 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/cpuguy83/go-md2man/v2/LICENSE.md renamed to vendor/github.com/alecthomas/kong/COPYING

Lines changed: 7 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)