Use pointer receiver in stateData

This commit is contained in:
Ken-Håvard Lieng 2019-01-23 08:20:16 +01:00
parent 24b26aa85f
commit 5e674254f0
1 changed files with 5 additions and 5 deletions

View File

@ -236,28 +236,28 @@ type stateData struct {
lock sync.Mutex
}
func (s stateData) Get(key string) interface{} {
func (s *stateData) Get(key string) interface{} {
s.lock.Lock()
v := s.m[key]
s.lock.Unlock()
return v
}
func (s stateData) Set(key string, value interface{}) {
func (s *stateData) Set(key string, value interface{}) {
s.lock.Lock()
s.m[key] = value
s.lock.Unlock()
}
func (s stateData) String(key string) string {
func (s *stateData) String(key string) string {
return s.Get(key).(string)
}
func (s stateData) Int(key string) int {
func (s *stateData) Int(key string) int {
return s.Get(key).(int)
}
func (s stateData) Bool(key string) bool {
func (s *stateData) Bool(key string) bool {
return s.Get(key).(bool)
}