fixup lint errors
All checks were successful
pipeline / test (pull_request) Successful in 43s
pipeline / lint (pull_request) Successful in 10m1s

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2024-12-06 18:52:37 +03:00
parent 7bda00cd80
commit 2bbbaf8963
23 changed files with 157 additions and 115 deletions

View File

@@ -91,7 +91,7 @@ func Merge(dst interface{}, mp map[string]interface{}, opts ...Option) error {
}
if mapper, ok := dst.(map[string]interface{}); ok {
dst = mergeMap(mapper, mp, 0)
mergeMap(mapper, mp, 0)
return nil
}

View File

@@ -1,9 +1,38 @@
package reflect
import (
"fmt"
"testing"
)
func TestMergeMapStringInterface(t *testing.T) {
var dst interface{} //nolint:gosimple
dst = map[string]interface{}{
"xx": 11,
}
src := map[string]interface{}{
"zz": "aa",
}
if err := Merge(dst, src); err != nil {
t.Fatal(err)
}
mp, ok := dst.(map[string]interface{})
if !ok || mp == nil {
t.Fatalf("xxx %#+v\n", dst)
}
if fmt.Sprintf("%v", mp["xx"]) != "11" {
t.Fatalf("xxx zzzz %#+v", mp)
}
if fmt.Sprintf("%v", mp["zz"]) != "aa" {
t.Fatalf("xxx zzzz %#+v", mp)
}
}
func TestMergeMap(t *testing.T) {
src := map[string]interface{}{
"skey1": "sval1",