diff --git a/ini.go b/ini.go index f8419ae..8a448d7 100644 --- a/ini.go +++ b/ini.go @@ -37,7 +37,7 @@ const ( // Maximum allowed depth when recursively substituing variable names. _DEPTH_VALUES = 99 - _VERSION = "1.25.1" + _VERSION = "1.25.2" ) // Version returns current package version literal. @@ -221,6 +221,12 @@ func InsensitiveLoad(source interface{}, others ...interface{}) (*File, error) { return LoadSources(LoadOptions{Insensitive: true}, source, others...) } +// InsensitiveLoad has exactly same functionality as Load function +// except it allows have shadow keys. +func ShadowLoad(source interface{}, others ...interface{}) (*File, error) { + return LoadSources(LoadOptions{AllowShadows: true}, source, others...) +} + // Empty returns an empty file object. func Empty() *File { // Ignore error here, we sure our data is good. diff --git a/key_test.go b/key_test.go index 8029047..1281d5b 100644 --- a/key_test.go +++ b/key_test.go @@ -455,7 +455,7 @@ func Test_Key_Shadows(t *testing.T) { }) Convey("Enable shadows", func() { - cfg, err := LoadSources(LoadOptions{AllowShadows: true}, []byte(_CONF_GIT_CONFIG)) + cfg, err := ShadowLoad([]byte(_CONF_GIT_CONFIG)) So(err, ShouldBeNil) So(cfg.Section(`remote "origin"`).Key("url").String(), ShouldEqual, "https://github.com/Antergone/test1.git") So(strings.Join(cfg.Section(`remote "origin"`).Key("url").ValueWithShadows(), " "), ShouldEqual,