<commit_before>package terraform

import (
	"archive/zip"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"path/filepath"
	"runtime"
)

// Download : Launch download
func (release Release) Download(quiet bool) error {
	// Formulation URL Terraform Website
	url := fmt.Sprintf(release.Repository, release.Version, release.Version, runtime.GOOS, runtime.GOARCH)

	// Request GET URL
	resp, err := release.HTTPclient.Get("https://" + url)
	if err != nil {
		return err
	}
	defer resp.Body.Close()

	// Verify code equal 200
	if (err == nil) && (resp.StatusCode == 200) {
		Message("\033[1;32mStart download ...\n", quiet)
		fileUnzip, err := os.Create(fmt.Sprintf("%s%sterraform-%s.zip", release.Home, folders["tmp"], release.Version))
		if err != nil {
			return err
		}
		defer fileUnzip.Close()

		// Copy reponse in file
		_, err = io.Copy(fileUnzip, resp.Body)
		if err != nil {
			return err
		}
		return nil
	}
	Message("\033[1;31m[ERROR] Failed, this version doesn't exist !", quiet)
	return nil
}

// UnZipFile : UnZip one file
func (release Release) unZip(archive string, target string) error {

	reader, err := zip.OpenReader(filepath.Join(archive))
	if err != nil {
		return err
	}

	for _, file := range reader.File {
		path := filepath.Join(target, file.Name)
		if file.FileInfo().IsDir() {
			os.MkdirAll(path, file.Mode())
			continue
		}

		fileReader, err := file.Open()
		if err != nil {
			return err
		}
		defer fileReader.Close()

		targetFile, err := os.OpenFile(filepath.Join(release.Home, folders["bin"], "terraform"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, file.Mode())
		if err != nil {
			return err
		}
		defer targetFile.Close()

		_, err = io.Copy(targetFile, fileReader)
		if err != nil {
			return err
		}
	}

	return err
}

// Install Terraform versions
func (release Release) Install(quiet bool) error {
	// UnZip archive
	Message("Install the binary file ...", quiet)
	if err := release.unZip(filepath.Join(release.Home, folders["tmp"], fmt.Sprintf("/terraform-%s.zip", release.Version)), filepath.Join(release.Home, folders["bin"])); err != nil {
		return err
	}

	// Save version in file
	if err := ioutil.WriteFile(filepath.Join(release.Home, folders["tmp"], ".version"), []byte(release.Version), 0600); err != nil {
		return err
	}

	Message(fmt.Sprintf("v%s installed ♥", release.Version), quiet)

	return nil
}
<commit_msg>Deleting color messages<commit_after>package terraform

import (
	"archive/zip"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"path/filepath"
	"runtime"
)

// Download : Launch download
func (release Release) Download(quiet bool) error {
	// Formulation URL Terraform Website
	url := fmt.Sprintf(release.Repository, release.Version, release.Version, runtime.GOOS, runtime.GOARCH)

	// Request GET URL
	resp, err := release.HTTPclient.Get("https://" + url)
	if err != nil {
		return err
	}
	defer resp.Body.Close()

	// Verify code equal 200
	if (err == nil) && (resp.StatusCode == 200) {
		Message("Start download ...\n", quiet)

		fileUnzip, err := os.Create(fmt.Sprintf("%s%sterraform-%s.zip", release.Home, folders["tmp"], release.Version))
		if err != nil {
			return err
		}
		defer fileUnzip.Close()

		// Copy reponse in file
		_, err = io.Copy(fileUnzip, resp.Body)

		return err
	}

	Message("Failed, this version doesn't exist !", quiet)

	return nil
}

// UnZipFile : UnZip one file
func (release Release) unZip(archive string, target string) error {

	reader, err := zip.OpenReader(filepath.Join(archive))
	if err != nil {
		return err
	}

	for _, file := range reader.File {
		path := filepath.Join(target, file.Name)
		if file.FileInfo().IsDir() {
			os.MkdirAll(path, file.Mode())
			continue
		}

		fileReader, err := file.Open()
		if err != nil {
			return err
		}
		defer fileReader.Close()

		targetFile, err := os.OpenFile(filepath.Join(release.Home, folders["bin"], "terraform"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, file.Mode())
		if err != nil {
			return err
		}
		defer targetFile.Close()

		_, err = io.Copy(targetFile, fileReader)

		return err
	}

	return err
}

// Install Terraform versions
func (release Release) Install(quiet bool) error {
	// UnZip archive
	Message("Install the binary file ...", quiet)
	if err := release.unZip(filepath.Join(release.Home, folders["tmp"], fmt.Sprintf("/terraform-%s.zip", release.Version)), filepath.Join(release.Home, folders["bin"])); err != nil {
		return err
	}

	// Save version in file
	if err := ioutil.WriteFile(filepath.Join(release.Home, folders["tmp"], ".version"), []byte(release.Version), 0600); err != nil {
		return err
	}

	Message(fmt.Sprintf("v%s installed ♥", release.Version), quiet)

	return nil
}

{'fraction_non_alphanumeric': 0.15554592720970536, 'fraction_numerical': 0.006932409012131715, 'mean_word_length': 3.7451181911613567, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4893231', 'n_tokens_mistral': 1725, 'n_tokens_neox': 1573, 'n_words': 409}