Skip to content

Commit

Permalink
Fix rice race condition on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcfarlane committed Sep 19, 2018
1 parent caad206 commit 40dec66
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"path/filepath"
"testing"

rice "github.com/GeertJohan/go.rice"
"github.com/prometheus/common/log"
"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -65,6 +66,7 @@ func copyFile(fromPath, toPath string) error {
}

func setup(t *testing.T) Mock {
box = rice.MustFindBox("static")
tempDir, err := ioutil.TempDir(os.TempDir(), "notable-testing")
if !assert.Nil(t, err, "Error creating temp dir") {
return Mock{}
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
var booted = time.Now()
var db Backend
var idx bleve.Index
var box = rice.MustFindBox("static")
var box *rice.Box

// Flags
var (
Expand Down Expand Up @@ -268,5 +268,6 @@ func run(w io.Writer) {

func main() {
flag.Parse()
box = rice.MustFindBox("static")
run(os.Stdout)
}

0 comments on commit 40dec66

Please sign in to comment.