File: copystructure_examples_test.go

package info (click to toggle)
golang-github-mitchellh-copystructure 1.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 124 kB
  • sloc: makefile: 2
file content (22 lines) | stat: -rw-r--r-- 357 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package copystructure

import (
	"fmt"
)

func ExampleCopy() {
	input := map[string]interface{}{
		"bob": map[string]interface{}{
			"emails": []string{"a", "b"},
		},
	}

	dup, err := Copy(input)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%#v", dup)
	// Output:
	// map[string]interface {}{"bob":map[string]interface {}{"emails":[]string{"a", "b"}}}
}