The following code snippet was derived from the golang/sample_ber/employee sample program in the ASN1C distribution:
package main import ( "employee/asn1gen" "encoding/hex" "fmt" "io/ioutil" "os" ) func main() { var pdu asn1gen.PersonnelRecord encoding, err := ioutil.ReadFile("message.ber") if err != nil { fmt.Printf("Read message.ber failed: %s\n", err) return } _, err = asn1gen.Unmarshal(encoding, &pdu) if err == nil { fmt.Printf("Decoding was successful:\n") } else { fmt.Printf("Decoding failed: %s\n", err) }