Standard library / encoding/xml

encoding/xml.Directive.Copy()

Copies the directive byte slice independently. Expected stdout: 'Go\n'.

Formal Syntax & Structure

go syntaxgo
func (d Directive) Copy() Directive

Return Value

Directive

Independent directive copy.

Working Example

Example Snippetgo
package main
import (  "encoding/xml"  "fmt")
func must(e error) {  if e != nil {    panic(e)  }}
func main() { v := xml.Directive("Go"); c := v.Copy(); v[0] = 88; fmt.Println(string(c)) }
Go Reference