Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbcccab1

Browse files
committed
panic when accessing map elements before initializing
1 parent44dafcb commitbcccab1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎concurrent_map.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ func (m ConcurrentMap) Clear() {
198198
// It returns once the size of each buffered channel is determined,
199199
// before all the channels are populated using goroutines.
200200
funcsnapshot(mConcurrentMap) (chans []chanTuple) {
201+
//When you access map items before initializing.
202+
iflen(m)==0{
203+
panic(`cmap.ConcurrentMap is not initialized. Should run New() before usage.`)
204+
}
201205
chans=make([]chanTuple,SHARD_COUNT)
202206
wg:= sync.WaitGroup{}
203207
wg.Add(SHARD_COUNT)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp