Skip to content

Commit

Permalink
Remove superfluous constructs of store
Browse files Browse the repository at this point in the history
  • Loading branch information
tino committed Dec 6, 2017
1 parent 1fae4c4 commit 3e08824
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions route/no_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,21 @@ import (
"sync/atomic"
)

// HTML Wrapper struct so we can store the html string in an atomic.Value
type HTML struct {
value string
}

// html stores the no route html string
var store atomic.Value
var store atomic.Value // string

func init() {
store.Store(HTML{""})
store.Store("")
}

// GetHTML returns the HTML for not found routes. The function is safe to be
// called from multiple goroutines.
// GetHTML returns the HTML for not found routes.
func GetHTML() string {
return store.Load().(HTML).value
return store.Load().(string)
}

// SetHTML sets the current noroute html. The function is safe to be called from
// multiple goroutines.
// SetHTML sets the current noroute html.
func SetHTML(h string) {
html := HTML{h}
store.Store(html)
// html := HTML{h}
store.Store(h)

if h == "" {
log.Print("[INFO] Unset noroute HTML")
Expand Down

0 comments on commit 3e08824

Please sign in to comment.