...

Source file src/github.com/mitchellh/copystructure/copystructure_examples_test.go

Documentation: github.com/mitchellh/copystructure

     1  package copystructure
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  func ExampleCopy() {
     8  	input := map[string]interface{}{
     9  		"bob": map[string]interface{}{
    10  			"emails": []string{"a", "b"},
    11  		},
    12  	}
    13  
    14  	dup, err := Copy(input)
    15  	if err != nil {
    16  		panic(err)
    17  	}
    18  
    19  	fmt.Printf("%#v", dup)
    20  	// Output:
    21  	// map[string]interface {}{"bob":map[string]interface {}{"emails":[]string{"a", "b"}}}
    22  }
    23  

View as plain text