all: Use automaxprocs without logger

It is just logspam outside of containerized environments.

Change-Id: Id08c778cb521204858ec58422cea8fe83cb67879
diff --git a/cmd/zoekt-archive-index/main.go b/cmd/zoekt-archive-index/main.go
index 24c362e..2755088 100644
--- a/cmd/zoekt-archive-index/main.go
+++ b/cmd/zoekt-archive-index/main.go
@@ -22,9 +22,7 @@
 	"github.com/google/zoekt/build"
 	"github.com/google/zoekt/cmd"
 	"github.com/google/zoekt/gitindex"
-
-	// Tune GOMAXPROCS to match Linux container CPU quota.
-	_ "go.uber.org/automaxprocs"
+	"go.uber.org/automaxprocs/maxprocs"
 )
 
 // stripComponents removes the specified number of leading path
@@ -210,6 +208,9 @@
 	)
 	flag.Parse()
 
+	// Tune GOMAXPROCS to match Linux container CPU quota.
+	maxprocs.Set()
+
 	log.SetFlags(log.LstdFlags | log.Lshortfile)
 
 	if len(flag.Args()) != 1 {
diff --git a/cmd/zoekt-git-index/main.go b/cmd/zoekt-git-index/main.go
index b0acf33..50997e5 100644
--- a/cmd/zoekt-git-index/main.go
+++ b/cmd/zoekt-git-index/main.go
@@ -23,9 +23,7 @@
 
 	"github.com/google/zoekt/cmd"
 	"github.com/google/zoekt/gitindex"
-
-	// Tune GOMAXPROCS to match Linux container CPU quota.
-	_ "go.uber.org/automaxprocs"
+	"go.uber.org/automaxprocs/maxprocs"
 )
 
 func main() {
@@ -40,6 +38,9 @@
 		"It also affects name if the indexed repository is under this directory.")
 	flag.Parse()
 
+	// Tune GOMAXPROCS to match Linux container CPU quota.
+	maxprocs.Set()
+
 	if *repoCacheDir != "" {
 		dir, err := filepath.Abs(*repoCacheDir)
 		if err != nil {
diff --git a/cmd/zoekt-index/main.go b/cmd/zoekt-index/main.go
index cde9fbf..7cf2a73 100644
--- a/cmd/zoekt-index/main.go
+++ b/cmd/zoekt-index/main.go
@@ -27,9 +27,7 @@
 	"github.com/google/zoekt"
 	"github.com/google/zoekt/build"
 	"github.com/google/zoekt/cmd"
-
-	// Tune GOMAXPROCS to match Linux container CPU quota.
-	_ "go.uber.org/automaxprocs"
+	"go.uber.org/automaxprocs/maxprocs"
 )
 
 type fileInfo struct {
@@ -66,6 +64,9 @@
 	ignoreDirs := flag.String("ignore_dirs", ".git,.hg,.svn", "comma separated list of directories to ignore.")
 	flag.Parse()
 
+	// Tune GOMAXPROCS to match Linux container CPU quota.
+	maxprocs.Set()
+
 	opts := cmd.OptionsFromFlags()
 	if *cpuProfile != "" {
 		f, err := os.Create(*cpuProfile)
diff --git a/cmd/zoekt-repo-index/main.go b/cmd/zoekt-repo-index/main.go
index 4469906..3977676 100644
--- a/cmd/zoekt-repo-index/main.go
+++ b/cmd/zoekt-repo-index/main.go
@@ -45,12 +45,10 @@
 	"github.com/google/zoekt"
 	"github.com/google/zoekt/build"
 	"github.com/google/zoekt/gitindex"
+	"go.uber.org/automaxprocs/maxprocs"
 
 	git "gopkg.in/src-d/go-git.v4"
 	"gopkg.in/src-d/go-git.v4/plumbing"
-
-	// Tune GOMAXPROCS to match Linux container CPU quota.
-	_ "go.uber.org/automaxprocs"
 )
 
 var _ = log.Println
@@ -139,6 +137,9 @@
 	incremental := flag.Bool("incremental", true, "only index if the repository has changed.")
 	flag.Parse()
 
+	// Tune GOMAXPROCS to match Linux container CPU quota.
+	maxprocs.Set()
+
 	if *repoCacheDir == "" {
 		log.Fatal("must set --repo_cache")
 	}
diff --git a/cmd/zoekt-webserver/main.go b/cmd/zoekt-webserver/main.go
index 3478bee..a0ab5d0 100644
--- a/cmd/zoekt-webserver/main.go
+++ b/cmd/zoekt-webserver/main.go
@@ -29,15 +29,12 @@
 	"strings"
 	"time"
 
-	"golang.org/x/net/trace"
-
 	"github.com/google/zoekt"
 	"github.com/google/zoekt/build"
 	"github.com/google/zoekt/shards"
 	"github.com/google/zoekt/web"
-
-	// Tune GOMAXPROCS to match Linux container CPU quota.
-	_ "go.uber.org/automaxprocs"
+	"go.uber.org/automaxprocs/maxprocs"
+	"golang.org/x/net/trace"
 )
 
 const logFormat = "2006-01-02T15-04-05.999999999Z07"
@@ -145,6 +142,13 @@
 		go divertLogs(*logDir, *logRefresh)
 	}
 
+	// Tune GOMAXPROCS to match Linux container CPU quota.
+	maxprocs.Set()
+
+	if err := os.MkdirAll(*index, 0755); err != nil {
+		log.Fatal(err)
+	}
+
 	searcher, err := shards.NewDirectorySearcher(*index)
 	if err != nil {
 		log.Fatal(err)