func (da *PackageArchive) GetFileDownloadLocation(file *archive.File, packageName string, version string) (string, error) {
	if file == nil {
		return "", errors.New("Could not obtain the file from manifest")
	}
	fileName := file.Name
	if da.attachments == nil {
		if _, err := da.getDocument(packageName, version); err != nil {
			return "", err
		}
	}

	// if the attachments are still nil, return error
	if da.attachments == nil {
		return "", fmt.Errorf("Could not retreive the attachments for installation")
	}

	for _, attachmentContent := range da.attachments {
		if *attachmentContent.Name == fileName {
			return *attachmentContent.Url, nil
		}
	}

	return "", fmt.Errorf("Install attachments for package does not exist")

}
// GetFileDownloadLocation obtains the location of the file in the archive
// in the document archive, this information is stored in the attachmentContent
// field in the reult of GetDocument.
GetFileDownloadLocation obtains the location of the file in the archive
in the document archive, this information is stored in the attachmentContent
field in the reult of GetDocument.
// GetFileDownloadLocation obtains the location of the file in the archive // in the document archive this information is stored in the attachmentContent // field in the reult of GetDocument .
func (da *PackageArchive) GetFileDownloadLocation(file *archive.File, packageName string, version string) (string, error) {
	if file == nil {
		return "", errors.New("Could not obtain the file from manifest")
	}
	fileName := file.Name
	if da.attachments == nil {
		if _, err := da.getDocument(packageName, version); err != nil {
			return "", err
		}
	}
	if da.attachments == nil {
		return "", fmt.Errorf("Could not retreive the attachments for installation")
	}
	for _, attachmentContent := range da.attachments {
		if *attachmentContent.Name == fileName {
			return *attachmentContent.Url, nil
		}
	}
	return "", fmt.Errorf("Install attachments for package does not exist")
}
func ( da * PackageArchive ) GetFileDownloadLocation ( file * archive . File , packageName string , version string ) ( string , error ) { if file == nil { return " " , errors . New ( " " ) } fileName := file . Name if da . attachments == nil { if _ , err := da . getDocument ( packageName , version ) ; err != nil { return " " , err } } if da . attachments == nil { return " " , fmt . Errorf ( " " ) } for _ , attachmentContent := range da . attachments { if * attachmentContent . Name == fileName { return * attachmentContent . Url , nil } } return " " , fmt . Errorf ( " " ) }
GetFileDownloadLocation obtains the location of the file in the archive
in the document archive, this information is stored in the attachmentContent
field in the reult of GetDocument.
GetFileDownloadLocation obtains the location of the file in the archive in the document archive this information is stored in the attachmentContent field in the reult of GetDocument .
// if the attachments are still nil, return error