<commit_before>package gb

// gc toolchain

import (
	"fmt"
	"go/build"
	"os"
	"path/filepath"
	"runtime"
)

type gcToolchain struct {
	goroot, goos, goarch string
	gc, cc, ld, as, pack string
}

type gcoption struct {
	goroot, goos, goarch string
}

// Goroot configures GcToolchain.
func Goroot(goroot string) func(*gcoption) {
	return func(opts *gcoption) {
		opts.goroot = goroot
	}
}

func GcToolchain(opts ...func(*gcoption)) func(c *Context) error {
	defaults := []func(*gcoption){
		func(opt *gcoption) {
			opt.goroot = runtime.GOROOT()
		},
		func(opt *gcoption) {
			opt.goos = runtime.GOOS
		},
		func(opt *gcoption) {
			opt.goarch = runtime.GOARCH
		},
	}
	var options gcoption
	for _, opt := range append(defaults, opts...) {
		opt(&options)
	}

	return func(c *Context) error {
		goroot := options.goroot
		goos := options.goos
		goarch := options.goarch
		archchar, err := build.ArchChar(goarch)
		if err != nil {
			return err
		}
		tooldir := filepath.Join(goroot, "pkg", "tool", goos+"_"+goarch)
		c.tc = &gcToolchain{
			goroot: goroot,
			goos:   goos,
			goarch: goarch,
			gc:     filepath.Join(tooldir, archchar+"g"),
			ld:     filepath.Join(tooldir, archchar+"l"),
			as:     filepath.Join(tooldir, archchar+"a"),
			pack:   filepath.Join(tooldir, "pack"),
		}
		return nil
	}<commit_msg>remove gc.goroot<commit_after>package gb

// gc toolchain

import (
	"fmt"
	"go/build"
	"os"
	"path/filepath"
	"runtime"
)

type gcToolchain struct {
	goos, goarch         string
	gc, cc, ld, as, pack string
}

type gcoption struct {
	goroot, goos, goarch string
}

// Goroot configures GcToolchain.
func Goroot(goroot string) func(*gcoption) {
	return func(opts *gcoption) {
		opts.goroot = goroot
	}
}

func GcToolchain(opts ...func(*gcoption)) func(c *Context) error {
	defaults := []func(*gcoption){
		func(opt *gcoption) {
			opt.goroot = runtime.GOROOT()
		},
		func(opt *gcoption) {
			opt.goos = runtime.GOOS
		},
		func(opt *gcoption) {
			opt.goarch = runtime.GOARCH
		},
	}
	var options gcoption
	for _, opt := range append(defaults, opts...) {
		opt(&options)
	}

	return func(c *Context) error {
		goroot := options.goroot
		goos := options.goos
		goarch := options.goarch
		archchar, err := build.ArchChar(goarch)
		if err != nil {
			return err
		}
		tooldir := filepath.Join(goroot, "pkg", "tool", goos+"_"+goarch)
		c.tc = &gcToolchain{
			goos:   goos,
			goarch: goarch,
			gc:     filepath.Join(tooldir, archchar+"g"),
			ld:     filepath.Join(tooldir, archchar+"l"),
			as:     filepath.Join(tooldir, archchar+"a"),
			pack:   filepath.Join(tooldir, "pack"),
		}
		return nil
	}
{'fraction_non_alphanumeric': 0.15072685539403213, 'fraction_numerical': 0.0, 'mean_word_length': 3.3949579831932772, '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': '1278575', 'n_tokens_mistral': 1115, 'n_tokens_neox': 1028, 'n_words': 230}