mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
Updated Questions (markdown)
parent
e7236afb6e
commit
e5a7db38a5
26
Questions.md
26
Questions.md
@ -1,26 +0,0 @@
|
|||||||
# Asking Questions
|
|
||||||
|
|
||||||
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and [proposals](https://go.dev/s/proposal-process) only.
|
|
||||||
|
|
||||||
For asking questions, see:
|
|
||||||
|
|
||||||
* [The official Q&A channel for Google's Go Programming Language
|
|
||||||
](https://stackoverflow.com/collectives/go) on Stack Overflow
|
|
||||||
|
|
||||||
* [Stack Overflow](https://stackoverflow.com/questions/tagged/go) with questions tagged "go" or "golang" (complementing the Go Collective mentioned before)
|
|
||||||
|
|
||||||
* [The Go Forum](https://forum.golangbridge.org/), a web-based forum
|
|
||||||
|
|
||||||
* [Gophers Slack](https://gophers.slack.com), use the [invite app](https://invite.slack.golangbridge.org/) for access. The `#general` channel is a good starting point.
|
|
||||||
|
|
||||||
* [Go Community on Hashnode](https://hashnode.com/n/go) with questions and posts tagged with "go"
|
|
||||||
|
|
||||||
* [The golang-nuts mailing list](https://groups.google.com/d/forum/golang-nuts)
|
|
||||||
|
|
||||||
* [Subreddit for Go](https://www.reddit.com/r/golang/)
|
|
||||||
|
|
||||||
* **IRC** channel #go-nuts on Libera
|
|
||||||
|
|
||||||
If we closed your issue as a question with a link to this wiki, we apologize. Please ask the question on one of the above forums.
|
|
||||||
|
|
||||||
Please do not write your question on a wiki page. Please use one of the above forums.
|
|
@ -0,0 +1,49 @@
|
|||||||
|
What version of Go are you using (go version)?
|
||||||
|
$ go version 1.18.2
|
||||||
|
Does this issue reproduce with the latest release?
|
||||||
|
yes
|
||||||
|
|
||||||
|
What operating system and processor architecture are you using (go env)?
|
||||||
|
linux & windows , amd64
|
||||||
|
|
||||||
|
What did you do?
|
||||||
|
https://go.dev/play/p/wi_i3Dx8Hpa
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
func clearMap(m map[string]string) {
|
||||||
|
for k := range m {
|
||||||
|
delete(m, k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//go:noinline
|
||||||
|
func clearMap2(m map[string]string) {
|
||||||
|
for k := range m {
|
||||||
|
delete(m, k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var m map[string]string
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
clearMap(m)
|
||||||
|
clearMap2(m)
|
||||||
|
}
|
||||||
|
In go1.18, the compiler will inline clearMap by default, then generates:
|
||||||
|
|
||||||
|
CALL runtime.mapiterinit(SB)
|
||||||
|
JMP 0x45b3c9
|
||||||
|
MOVQ 0(DX), CX
|
||||||
|
MOVQ 0x8(DX), DI
|
||||||
|
LEAQ type.*+23744(SB), AX
|
||||||
|
MOVQ 0x20(SP), BX
|
||||||
|
CALL runtime.mapdelete_faststr(SB)
|
||||||
|
LEAQ 0x28(SP), AX
|
||||||
|
CALL runtime.mapiternext(SB)
|
||||||
|
MOVQ 0x28(SP), DX
|
||||||
|
TESTQ DX, DX
|
||||||
|
JNE 0x45b3a7
|
||||||
|
and clearMap2 will call runtime.mapclear.
|
||||||
|
|
||||||
|
Is this expected behavior?
|
Loading…
x
Reference in New Issue
Block a user