diff --git a/LICENSE b/LICENSE index a5bad7f..cd68d76 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ Copyright 2017 otiai10 (Hiromu OCHIAI) -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to interface{} person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF interface{} KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR interface{} CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/all_test.go b/all_test.go index ccd0122..f621eda 100644 --- a/all_test.go +++ b/all_test.go @@ -161,9 +161,9 @@ func TestRequire(t *testing.T) { } func TestTestee_Query(t *testing.T) { - v := map[string]any{ - "foo": map[string]any{"name": "otiai10", "age": 30}, - "bar": []any{100, "helllo"}, + v := map[string]interface{}{ + "foo": map[string]interface{}{"name": "otiai10", "age": 30}, + "bar": []interface{}{100, "helllo"}, } mint.Expect(t, "foo").Query("foo").ToBe("foo") mint.Expect(t, "foo").Query("bar").Not().ToBe("bar") diff --git a/exit_test.go b/exit_test.go index ac65bbb..7ddfddf 100644 --- a/exit_test.go +++ b/exit_test.go @@ -1,3 +1,4 @@ +//go:build !freebsd // +build !freebsd package mint_test diff --git a/mquery/README.md b/mquery/README.md index ea2727d..4992930 100644 --- a/mquery/README.md +++ b/mquery/README.md @@ -4,12 +4,12 @@ mquery ```go import mquery -var m = map[string]any{ +var m = map[string]interface{}{ "foo": "bar", - "hoge": map[string]any{ + "hoge": map[string]interface{}{ "name": "otiai10", }, - "fuga": map[int]map[string]any{ + "fuga": map[int]map[string]interface{}{ 0: {"greet": "Hello"}, 1: {"greet": "こんにちは"}, }, diff --git a/mquery/all_test.go b/mquery/all_test.go index 8890f60..f9d6d8e 100644 --- a/mquery/all_test.go +++ b/mquery/all_test.go @@ -4,12 +4,12 @@ import ( "testing" ) -var m = map[string]any{ +var m = map[string]interface{}{ "foo": "bar", - "hoge": map[string]any{ + "hoge": map[string]interface{}{ "name": "otiai10", }, - "fuga": map[int]map[string]any{ + "fuga": map[int]map[string]interface{}{ 0: {"greet": "Hello"}, 1: {"greet": "こんにちは"}, }, diff --git a/mquery/example_test.go b/mquery/example_test.go index 2bd61b1..ff2b8f4 100644 --- a/mquery/example_test.go +++ b/mquery/example_test.go @@ -1,11 +1,11 @@ package mquery -var a = map[string]any{ +var a = map[string]interface{}{ "foo": "bar", - "hoge": map[string]any{ + "hoge": map[string]interface{}{ "name": "otiai10", }, - "fuga": map[int]map[string]any{ + "fuga": map[int]map[string]interface{}{ 0: {"greet": "Hello"}, 1: {"greet": "こんにちは"}, }, diff --git a/mquery/mquery.go b/mquery/mquery.go index 7da47aa..2a7ddba 100644 --- a/mquery/mquery.go +++ b/mquery/mquery.go @@ -7,11 +7,11 @@ import ( "strings" ) -func Query(m any, q string) any { +func Query(m interface{}, q string) interface{} { return query(m, strings.Split(q, ".")) } -func query(m any, qs []string) any { +func query(m interface{}, qs []string) interface{} { t := reflect.TypeOf(m) switch t.Kind() { case reflect.Map: @@ -23,7 +23,7 @@ func query(m any, qs []string) any { } } -func queryMap(m any, t reflect.Type, qs []string) any { +func queryMap(m interface{}, t reflect.Type, qs []string) interface{} { if len(qs) == 0 { return m } @@ -52,7 +52,7 @@ func queryMap(m any, t reflect.Type, qs []string) any { return nil } -func querySlice(m any, t reflect.Type, qs []string) any { +func querySlice(m interface{}, t reflect.Type, qs []string) interface{} { if len(qs) == 0 { return m }