<commit_before>package release

import (
	"crypto/sha1"
	"fmt"
	"io"
	"io/ioutil"

	"github.com/pkg/errors"
)

type Binary struct {
	Name      string `yaml:"name"`
	Checksum  string `yaml:"checksum"`
	Timestamp string `yaml:"timestamp"`
	Version   string `yaml:"version,omitempty"`
	Body      io.Reader
}

func BuildBinary(name string, body io.Reader) (*Binary, error) {
	sum, err := checksum(body)
	if err != nil {
		return nil, err
	}
	return &Binary{
		Name:      name,
		Checksum:  sum,
		Timestamp: Now(),
	}, nil
}

func checksum(r io.Reader) (string, error) {
	body, err := ioutil.ReadAll(r)
	if err != nil {
		errors.Errorf("failed to read data for checksum")
	}
	return fmt.Sprintf("%x", sha1.Sum(body)), nil
}
<commit_msg>Remove Binary.Timestamp because each binary's timestamp in a release is the same<commit_after>package release

import (
	"crypto/sha1"
	"fmt"
	"io"
	"io/ioutil"

	"github.com/pkg/errors"
)

type Binary struct {
	Name     string `yaml:"name"`
	Checksum string `yaml:"checksum"`
	Version  string `yaml:"version,omitempty"`
	Body     io.Reader
}

func BuildBinary(name string, body io.Reader) (*Binary, error) {
	sum, err := checksum(body)
	if err != nil {
		return nil, err
	}
	return &Binary{
		Name:     name,
		Checksum: sum,
	}, nil
}

func checksum(r io.Reader) (string, error) {
	body, err := ioutil.ReadAll(r)
	if err != nil {
		errors.Errorf("failed to read data for checksum")
	}
	return fmt.Sprintf("%x", sha1.Sum(body)), nil
}

{'fraction_non_alphanumeric': 0.14509536784741145, 'fraction_numerical': 0.0027247956403269754, 'mean_word_length': 3.816393442622951, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5178116', 'n_tokens_mistral': 549, 'n_tokens_neox': 537, 'n_words': 148}