需要帮助在GoLang中读写ECDSA密钥

Currently, I have:

// generate keys
priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
// get public key
pub := priv.Public()

I, however, need help on getting the raw byte data and using the correct encoding to read/write these public and private keys to files.

Just marshal them to a []byte using x509.MarshalECPrivateKey. You can just read and write the binary to a file.

You might find in future you want to store the keys in PEM format, as is common. You can do that with the encoding/pem package.