Skip to content

Commit

Permalink
Turn /maps to a standalone module.
Browse files Browse the repository at this point in the history
Some providers (structs, vault) and parsers (dotenv) require helper
functions in the maps package, which creates a cyclical dependency
with the koanf package. Separating maps to its own module addresses this
and also makes it generally useful outside of koanf.
  • Loading branch information
knadh committed Feb 8, 2023
1 parent cb4c2c1 commit 5fa472b
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 513 deletions.
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ module github.com/knadh/koanf-test

go 1.18

replace github.com/knadh/koanf-test/maps => ./maps

require (
github.com/fsnotify/fsnotify v1.4.9
github.com/knadh/koanf-test/maps v0.0.0-00010101000000-000000000000
github.com/mitchellh/copystructure v1.2.0
github.com/mitchellh/mapstructure v1.5.0
github.com/stretchr/testify v1.7.0
Expand Down
7 changes: 7 additions & 0 deletions maps/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module github.com/knadh/koanf-test/maps

go 1.19

require github.com/mitchellh/copystructure v1.2.0

require github.com/mitchellh/reflectwalk v1.0.2 // indirect
4 changes: 4 additions & 0 deletions maps/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
7 changes: 5 additions & 2 deletions parsers/dotenv/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ module github.com/knadh/koanf-test/parsers/dotenv

go 1.18

replace github.com/knadh/koanf-test => ../../
replace (
github.com/knadh/koanf-test => ../../
github.com/knadh/koanf-test/maps => ../../maps
)

require (
github.com/joho/godotenv v1.5.1
github.com/knadh/koanf-test v0.0.0-00010101000000-000000000000
github.com/knadh/koanf-test/maps v0.0.0-00010101000000-000000000000
github.com/stretchr/testify v1.8.1
)

Expand Down
362 changes: 1 addition & 361 deletions parsers/dotenv/go.sum

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion providers/posflag/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ module github.com/knadh/koanf-test/providers/posflag

go 1.18

replace github.com/knadh/koanf-test => ../../
replace (
github.com/knadh/koanf-test => ../../
github.com/knadh/koanf-test/maps => ../../maps
)

require (
github.com/knadh/koanf-test v0.0.0-00010101000000-000000000000
github.com/knadh/koanf-test/maps v0.0.0-00010101000000-000000000000
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.1
)
Expand Down
7 changes: 5 additions & 2 deletions providers/structs/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ module github.com/knadh/koanf-test/providers/structs

go 1.18

replace github.com/knadh/koanf-test => ../../
replace (
github.com/knadh/koanf-test => ../../
github.com/knadh/koanf-test/maps => ../../maps
)

require (
github.com/fatih/structs v1.1.0
github.com/knadh/koanf-test v0.0.0-00010101000000-000000000000
github.com/knadh/koanf-test/maps v0.0.0-00010101000000-000000000000
)

require (
Expand Down
7 changes: 5 additions & 2 deletions providers/vault/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ module github.com/knadh/koanf-test/providers/vault

go 1.18

replace github.com/knadh/koanf-test => ../../
replace (
github.com/knadh/koanf-test => ../../
github.com/knadh/koanf-test/maps => ../../maps
)

require (
github.com/hashicorp/vault/api v1.8.3
github.com/knadh/koanf-test v0.0.0-00010101000000-000000000000
github.com/knadh/koanf-test/maps v0.0.0-00010101000000-000000000000
)

require (
Expand Down
148 changes: 3 additions & 145 deletions providers/vault/go.sum

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.18

replace (
github.com/knadh/koanf-test => ../
github.com/knadh/koanf-test/maps => ../maps
github.com/knadh/koanf-test/parsers/dotenv => ../parsers/dotenv
github.com/knadh/koanf-test/parsers/hcl => ../parsers/hcl
github.com/knadh/koanf-test/parsers/hjson => ../parsers/hjson
Expand All @@ -30,6 +31,7 @@ require (
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hjson/hjson-go/v4 v4.3.0 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/knadh/koanf-test/maps v0.0.0-00010101000000-000000000000 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
Expand Down

0 comments on commit 5fa472b

Please sign in to comment.