get rid of init

This commit is contained in:
Matt Jaffee 2019-01-18 12:47:32 -06:00
parent 04c7ab5034
commit b7973b75f1
No known key found for this signature in database
GPG key ID: 08A3DFFF987B11BF

View file

@ -36,17 +36,19 @@ import (
)
var (
TempDir *string
TempDir = getTempDirString()
)
func init() { // nolint: gochecknoinits
func getTempDirString() (td *string) {
tdflag := flag.Lookup("temp-dir")
if tdflag == nil {
TempDir = flag.String("temp-dir", "", "Directory in which to place temporary data (e.g. for benchmarking). Useful if you are trying to benchmark different storage configurations.")
td = flag.String("temp-dir", "", "Directory in which to place temporary data (e.g. for benchmarking). Useful if you are trying to benchmark different storage configurations.")
} else {
s := tdflag.Value.String()
TempDir = &s
td = &s
}
return td
}
// Ensure a row query can be executed.