code: func RawTxInSignature(tx *wire.MsgTx, idx int, subScript []byte,
  	hashType SigHashType, key *btcec.PrivateKey) ([]byte, error) {
  
  	hash, err := CalcSignatureHash(subScript, hashType, tx, idx)
  	if err != nil {
  		return nil, err
  	}
  	signature, err := key.Sign(hash)
  	if err != nil {
  		return nil, fmt.Errorf("cannot sign tx input: %s", err)
  	}
  
  	return append(signature.Serialize(), byte(hashType)), nil
  }
docs: // RawTxInSignature returns the serialized ECDSA signature for the input idx of
  // the given transaction, with hashType appended to it.