code: func CalcWitnessSigHash(script []byte, sigHashes *TxSigHashes, hType SigHashType,
  	tx *wire.MsgTx, idx int, amt int64) ([]byte, error) {
  
  	parsedScript, err := parseScript(script)
  	if err != nil {
  		return nil, fmt.Errorf("cannot parse output script: %v", err)
  	}
  
  	return calcWitnessSignatureHash(parsedScript, sigHashes, hType, tx, idx,
  		amt)
  }
docs: // CalcWitnessSigHash computes the sighash digest for the specified input of
  // the target transaction observing the desired sig hash type.