<commit_before>// Copyright 2015-2017 the u-root Authors. All rights reserved
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
	"flag"
	"io/ioutil"
	"log"
	"os"
	"path/filepath"
	"runtime"
)

func guessgoarch() {
	if arch := os.Getenv("GOARCH"); arch != "" {
		config.Arch = filepath.Clean(arch)
	} else {
		config.Arch = runtime.GOARCH
	}
}

func guessgoroot() {
	if root := os.Getenv("GOROOT"); root != "" {
		config.Goroot = filepath.Clean(root)
	} else {
		config.Goroot = runtime.GOROOT()
	}
	config.Gosrcroot = filepath.Dir(config.Goroot)
	log.Printf("Using %q as GOROOT", config.Goroot)
}

func guessgopath() {
	gopath := os.Getenv("GOPATH")
	if gopath != "" {
		config.Gopath = gopath
		config.Gopaths = []string{gopath}
		return
	}
	log.Fatalf("You have to set GOPATH, which is typically ~/go")
}

func doConfig() {
	var err error
	flag.BoolVar(&config.Debug, "d", false, "Debugging")
	flag.Parse()
	if config.Debug {
		debug = debugPrint
	}
	if config.Cwd, err = os.Getwd(); err != nil {
		log.Fatalf("Getwd: %v", err)
	}

	guessgoroot()
	guessgopath()
	guessgoarch()
	config.Gosrcroot = filepath.Dir(config.Goroot)
	config.Goos = "linux"
	config.TempDir, err = ioutil.TempDir("", "u-root")
	config.Go = ""
	if err != nil {
		log.Fatalf("%v", err)
	}<commit_msg>bb: Fix Gopath/Gopaths handling broken in bf8bc<commit_after>// Copyright 2015-2017 the u-root Authors. All rights reserved
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
	"flag"
	"io/ioutil"
	"log"
	"os"
	"path/filepath"
	"runtime"
	"strings"
)

func guessgoarch() {
	if arch := os.Getenv("GOARCH"); arch != "" {
		config.Arch = filepath.Clean(arch)
	} else {
		config.Arch = runtime.GOARCH
	}
}

func guessgoroot() {
	if root := os.Getenv("GOROOT"); root != "" {
		config.Goroot = filepath.Clean(root)
	} else {
		config.Goroot = runtime.GOROOT()
	}
	config.Gosrcroot = filepath.Dir(config.Goroot)
	log.Printf("Using %q as GOROOT", config.Goroot)
}

func guessgopath() {
	gopath := os.Getenv("GOPATH")
	if gopath != "" {
		config.Gopaths = strings.Split(gopath, ":")
		config.Gopath = config.Gopaths[0]
		return
	}
	log.Fatalf("You have to set GOPATH, which is typically ~/go")
}

func doConfig() {
	var err error
	flag.BoolVar(&config.Debug, "d", false, "Debugging")
	flag.Parse()
	if config.Debug {
		debug = debugPrint
	}
	if config.Cwd, err = os.Getwd(); err != nil {
		log.Fatalf("Getwd: %v", err)
	}

	guessgoroot()
	guessgopath()
	guessgoarch()
	config.Gosrcroot = filepath.Dir(config.Goroot)
	config.Goos = "linux"
	config.TempDir, err = ioutil.TempDir("", "u-root")
	config.Go = ""
	if err != nil {
		log.Fatalf("%v", err)
	}
{'fraction_non_alphanumeric': 0.16184971098265896, 'fraction_numerical': 0.006502890173410405, 'mean_word_length': 3.717206132879046, 'pattern_counts': {'":': 1, '<': 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': '4063070', 'n_tokens_mistral': 1132, 'n_tokens_neox': 1100, 'n_words': 259}