<commit_before>package github

import (
	"fmt"
	"path/filepath"

	"github.com/omeid/gonzo"
	"github.com/omeid/gonzo/context"

	"github.com/go-gonzo/archive/tar"
	"github.com/go-gonzo/compress/gzip"
	"github.com/go-gonzo/util"
	"github.com/go-gonzo/web"
)

type Release struct {
	User  string
	Repo  string
	Tag   string
	Pluck []string
}

//Get returns a channel of gonzo.Files that match the provided patterns.
func Get(ctx context.Context, release Release) gonzo.Pipe {

	return web.Get(
		context.WithValue(ctx, "repo", fmt.Sprintf("%s/%s#%s", release.User, release.Repo, release.Tag)),
		fmt.Sprintf(
			"https://codeload.github.com/%s/%s/tar.gz/%s",
			release.User,
			release.Repo,
			release.Tag,
		),
	).Pipe(
		gzip.Uncompress(),
		tar.Untar(tar.Options{
			StripComponenets: 1,
			Pluck:            release.Pluck,
		}),
		util.Rename(func(old string) string {
			return filepath.Join(release.Repo, old)
		}),
	)
}<commit_msg>use variadic instead of an explicit slice<commit_after>package github

import (
	"fmt"
	"path/filepath"

	"github.com/omeid/gonzo"
	"github.com/omeid/gonzo/context"

	"github.com/go-gonzo/archive/tar"
	"github.com/go-gonzo/compress/gzip"
	"github.com/go-gonzo/util"
	"github.com/go-gonzo/web"
)

type Release struct {
	User  string
	Repo  string
	Tag   string
	Pluck []string
}

func Get(ctx context.Context, release Release, releases ...Release) gonzo.Pipe {

	var all []gonzo.Pipe
	for _, release := range append([]Release{release}, releases...) {
		all = append(all, get(ctx, release))
	}

	switch len(all) {
	case 0:
		panic("Something went wrong: Expected at least one gonzo.Pipe got 0")
	case 1:
		return all[0]
	default:
		return util.Merge(all[0], all[1:]...)
	}
}

func get(ctx context.Context, release Release) gonzo.Pipe {

	repo := fmt.Sprintf("%s/%s#%s", release.User, release.Repo, release.Tag)
	ctx.Warn(repo)
	return web.Get(
		context.WithValue(ctx, "repo", repo),
		fmt.Sprintf(
			"https://codeload.github.com/%s/%s/tar.gz/%s",
			release.User,
			release.Repo,
			release.Tag,
		),
	).Pipe(
		gzip.Uncompress(),
		tar.Untar(tar.Options{
			StripComponenets: 1,
			Pluck:            release.Pluck,
		}),
		util.Rename(func(old string) string {
			return filepath.Join(release.Repo, old)
		}),
	)
}
{'fraction_non_alphanumeric': 0.15896980461811722, 'fraction_numerical': 0.003552397868561279, 'mean_word_length': 3.5150300601202407, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6828527', 'n_tokens_mistral': 934, 'n_tokens_neox': 869, 'n_words': 170}