code: func ConvertECPrivateKeyPEM(inPEM []byte) ([]byte, error) {
  	block, _ := pem.Decode(inPEM)
  	if block == nil {
  		return nil, errors.New("invalid pem bytes")
  	}
  
  	var ecPrivKey ecPrivateKey
  	if _, err := asn1.Unmarshal(block.Bytes, &ecPrivKey); err != nil {
  		return nil, errors.New("invalid ec private key")
  	}
  
  	var pkey privateKeyInfo
  	pkey.Version = 0
  	pkey.PrivateKeyAlgorithm = make([]asn1.ObjectIdentifier, 2)
  	pkey.PrivateKeyAlgorithm[0] = oidPublicKeyECDSA
  	pkey.PrivateKeyAlgorithm[1] = ecPrivKey.NamedCurveOID
  
  	// remove curve oid from private bytes as it is already mentioned in algorithm
  	ecPrivKey.NamedCurveOID = nil
  
  	privatekey, err := asn1.Marshal(ecPrivKey)
  	if err != nil {
  		return nil, err
  	}
  	pkey.PrivateKey = privatekey
  
  	der, err := asn1.Marshal(pkey)
  	if err != nil {
  		return nil, err
  	}
  
  	return pem.EncodeToMemory(&pem.Block{
  		Type:  "PRIVATE KEY",
  		Bytes: der,
  	}), nil
  }
docs: // ConvertECPrivateKeyPEM takes an EC Private Key as input and returns PKCS#8 version of it