Go是否接受变量中的空格,就像下划线一样? 它有什么作用? [重复]

This question already has an answer here:

Except prolog, I have never seen _ in modern languages mean something, mostly used in variable declarations such me_and_you_variable = bla bla.

What does this single _ means in Go? Is it a variable or what?

Will Go language have spaces in variable then, because now _ is a part of operator in the language (so confusing!!) ? e.g.

response, _, err := http.Get(kinopiko_flair)
</div>

_ in Go is a placeholder: in your case you simply don't need the second value returned from function http.Get(kinopiko_flair) so you simply throw it away.

It's a variable used when you just need something to assign a value to but don't need that value afterwards.

Also see this example from Effective Go:

type ByteSize float64

const (
    _           = iota // ignore first value by assigning to blank identifier
    KB ByteSize = 1 << (10 * iota)
    MB
    GB
    TB
    PB
    EB
    ZB
    YB
)

In this case the first value of special variable iota (which is 0) is not useful, so it's simply discarded: no memory will be used to store that value.