mirror of
https://github.com/golang/go
synced 2024-11-06 01:46:12 -07:00
ed15e82413
Reorg map flags a bit so we don't need any extra space for the extra flag. Fixes #23734 Change-Id: I436812156240ae90de53d0943fe1aabf3ea37417 Reviewed-on: https://go-review.googlesource.com/c/155918 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
33 lines
471 B
Go
33 lines
471 B
Go
// run
|
|
|
|
// Copyright 2018 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package main
|
|
|
|
func main() {
|
|
m := map[interface{}]int{}
|
|
k := []int{}
|
|
|
|
mustPanic(func() {
|
|
_ = m[k]
|
|
})
|
|
mustPanic(func() {
|
|
_, _ = m[k]
|
|
})
|
|
mustPanic(func() {
|
|
delete(m, k)
|
|
})
|
|
}
|
|
|
|
func mustPanic(f func()) {
|
|
defer func() {
|
|
r := recover()
|
|
if r == nil {
|
|
panic("didn't panic")
|
|
}
|
|
}()
|
|
f()
|
|
}
|