all: remove unused code

Change-Id: I5bec6094d9dc5d16c685b8cbbecc7e1bb278fde9
Reviewed-on: https://go-review.googlesource.com/c/benchmarks/+/487775
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
diff --git a/cmd/bent/bent.go b/cmd/bent/bent.go
index 0c722c9..1a1151d 100644
--- a/cmd/bent/bent.go
+++ b/cmd/bent/bent.go
@@ -60,17 +60,6 @@
 	Suites         []Suite
 }
 
-// The length of the path to the root of the git repo, inclusive.
-// For example, github.com/dr2chase/bent <--- bent is the repo.
-var pathLengths = map[string]int{
-	"github.com":    3,
-	"gitlab.com":    3,
-	"zombiezen.com": 3,
-	"gonum.org":     3,
-	"k8s.io":        2,
-	"go.uber.org":   2,
-}
-
 var verbose counterFlag
 
 var benchFile = "benchmarks-50.toml" // default list of benchmarks
@@ -722,7 +711,7 @@
 			}
 		case 1: // N times, for each benchmark, shuffle configurations and build with
 			permute := make([]int, len(todo.Configurations))
-			for ci, _ := range todo.Configurations {
+			for ci := range todo.Configurations {
 				permute[ci] = ci
 			}
 
@@ -1240,11 +1229,6 @@
 	return nil
 }
 
-// testBinaryName returns the name of the binary produced by "go test -c"
-func (b *Benchmark) testBinaryName() string {
-	return b.Repo[strings.LastIndex(b.Repo, "/")+1:] + ".test"
-}
-
 // inheritEnv extracts ev from the os environment and
 // returns env extended with that new environment variable.
 // Does not check if ev already exists in env.
@@ -1327,17 +1311,6 @@
 	return env
 }
 
-func removeEmptyEnvs(env []string) []string {
-	var newenv []string
-	for _, e := range env {
-		if i := strings.Index(e, "="); i == -1 || i == len(e)-1 {
-			continue
-		}
-		newenv = append(newenv, e)
-	}
-	return newenv
-}
-
 // ifMissingAddEnv returns a new environment derived from env
 // by adding ev=evv if env does not define env.
 func ifMissingAddEnv(env []string, ev string, evv string) []string {
diff --git a/cmd/bent/bent_test.go b/cmd/bent/bent_test.go
index c79c474..77b6f29 100644
--- a/cmd/bent/bent_test.go
+++ b/cmd/bent/bent_test.go
@@ -14,9 +14,7 @@
 	"testing"
 )
 
-const dataDir = "testdata"
-
-var binary, dir string
+var dir string
 
 // TestMain implemented to allow (1) alternate use as bent command itself if BENT_TEST_IS_CMD_BENT is in environment,
 // and (2) to create and remove a temporary directory for test initialization.
diff --git a/cmd/bent/configuration.go b/cmd/bent/configuration.go
index d035db1..d99c11b 100644
--- a/cmd/bent/configuration.go
+++ b/cmd/bent/configuration.go
@@ -56,14 +56,6 @@
 	return b.Name + "_" + c.Name
 }
 
-func (c *Configuration) goCommand() string {
-	gocmd := "go"
-	if c.Root != "" {
-		gocmd = path.Join(c.Root+"bin", gocmd)
-	}
-	return gocmd
-}
-
 func (c *Configuration) goCommandCopy() string {
 	gocmd := "go"
 	if c.rootCopy != "" {
@@ -239,7 +231,7 @@
 		}
 		buf.WriteString(s)
 		s = fmt.Sprintf("Benchmark%s 1 %d build-real-ns/op %d build-user-ns/op %d build-sys-ns/op\n",
-		strings.Title(bench.Name), bs.RealTime.Nanoseconds(), bs.UserTime.Nanoseconds(), bs.SysTime.Nanoseconds())
+			strings.Title(bench.Name), bs.RealTime.Nanoseconds(), bs.UserTime.Nanoseconds(), bs.SysTime.Nanoseconds())
 		if verbose > 0 {
 			fmt.Print(s)
 		}
diff --git a/garbage/garbage.go b/garbage/garbage.go
index 02332ae..1c26aa7 100644
--- a/garbage/garbage.go
+++ b/garbage/garbage.go
@@ -25,10 +25,6 @@
 	driver.Main("Garbage", benchmark)
 }
 
-// func init() {
-// 	driver.Register("garbage", benchmark)
-// }
-
 type ParsedPackage *ast.File
 
 var (
diff --git a/sweet/benchmarks/biogo-krishna/krishna.go b/sweet/benchmarks/biogo-krishna/krishna.go
index 1617937..ab4be4b 100644
--- a/sweet/benchmarks/biogo-krishna/krishna.go
+++ b/sweet/benchmarks/biogo-krishna/krishna.go
@@ -47,10 +47,10 @@
 		log.Fatal("error: input FASTA target sequence required")
 	}
 	k, err := krishna.New(flag.Arg(0), tmpDir, krishna.Params{
-		TmpChunkSize: 1e6,
-		MinHitLen:    400,
-		MinHitId:     0.94,
-		TubeOffset:   0,
+		TmpChunkSize: tmpChunk,
+		MinHitLen:    minHitLen,
+		MinHitId:     minId,
+		TubeOffset:   tubeOffset,
 		AlignConc:    alignconc,
 		TmpConc:      tmpConcurrent,
 	})
diff --git a/sweet/cmd/sweet/put.go b/sweet/cmd/sweet/put.go
index 893c40f..ff2d880 100644
--- a/sweet/cmd/sweet/put.go
+++ b/sweet/cmd/sweet/put.go
@@ -27,7 +27,6 @@
 type putCmd struct {
 	auth           bootstrap.AuthOption
 	force          bool
-	cache          string
 	bucket         string
 	assetsDir      string
 	assetsHashFile string
diff --git a/sweet/cmd/sweet/run.go b/sweet/cmd/sweet/run.go
index d9752da..9c49ee3 100644
--- a/sweet/cmd/sweet/run.go
+++ b/sweet/cmd/sweet/run.go
@@ -467,6 +467,9 @@
 
 	out := filepath.Join(dir, "merged.cpu")
 	f, err := os.Create(out)
+	if err != nil {
+		return "", fmt.Errorf("error creating file: %w", err)
+	}
 	defer f.Close()
 
 	if err := p.Write(f); err != nil {
diff --git a/sweet/generators/gvisor.go b/sweet/generators/gvisor.go
index e378151..b8ca1b1 100644
--- a/sweet/generators/gvisor.go
+++ b/sweet/generators/gvisor.go
@@ -29,7 +29,7 @@
 //
 // It also copies over static assets which are necessary to run the
 // benchmarks.
-func (_ GVisor) Generate(cfg *common.GenConfig) error {
+func (GVisor) Generate(cfg *common.GenConfig) error {
 	goTool := *cfg.GoTool
 	goTool.Env = goTool.Env.MustSet("CGO_ENABLED=0") // Disable CGO for workloads.
 
diff --git a/sweet/generators/none.go b/sweet/generators/none.go
index 20674e1..22d3520 100644
--- a/sweet/generators/none.go
+++ b/sweet/generators/none.go
@@ -10,6 +10,6 @@
 type None struct{}
 
 // Generate does nothing.
-func (_ None) Generate(_ *common.GenConfig) error {
+func (None) Generate(_ *common.GenConfig) error {
 	return nil
 }
diff --git a/sweet/generators/tile38.go b/sweet/generators/tile38.go
index b91c4f7..d16c58e 100644
--- a/sweet/generators/tile38.go
+++ b/sweet/generators/tile38.go
@@ -43,7 +43,7 @@
 //
 // This generator also copies over the static assets used to generate
 // the dynamic assets.
-func (_ Tile38) Generate(cfg *common.GenConfig) error {
+func (Tile38) Generate(cfg *common.GenConfig) error {
 	if cfg.AssetsDir != cfg.OutputDir {
 		// Copy over the datasets which are used to generate
 		// the server's persistent data.