Skip to content

Commit 61f6213

Browse files
author
sulin
committed
fix issue #16
1 parent 07ec4ea commit 61f6213

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

routine_api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ func InheritContext(ic *ImmutableContext) {
8383
}
8484
}
8585

86-
// NewLocalStorage create and return an new LocalStorage instance.
86+
// NewLocalStorage create and return a new LocalStorage instance.
8787
func NewLocalStorage() LocalStorage {
88-
return new(storage)
88+
return newStorage()
8989
}
9090

9191
// Goid get the unique goid of the current routine.

routine_api_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ func TestGoStorage(t *testing.T) {
1818
assert.True(t, v != nil && v.(string) == variable)
1919
})
2020
nap()
21+
22+
stg2 := NewLocalStorage()
23+
stg2.Set(int64(100))
24+
25+
v := stg.Get()
26+
assert.True(t, v != nil && v.(string) == variable)
27+
28+
v = stg2.Get()
29+
assert.True(t, v != nil && v.(int64) == 100)
2130
}
2231

2332
// BenchmarkGoid-12 1000000000 1.036 ns/op 0 B/op 0 allocs/op

0 commit comments

Comments
 (0)