为什么在下面的Go代码中不能使用空白标识符?

for _, arg := range flag.Args() {
    go func() {
        path.Walk(arg, dupes, walkerrs)
        walkend <- true
    }()
}
for _ := range flag.Args() {
    if !<-walkend {
        os.Exit(1)
    }
}

The second use of _ gives this error: no new variables on left side of :=. What have I done wrong?

Use this line:

for _ = range flag.Args() {

The error should disappear if you omit initialization for the blank identifier.

:= is a short variable declaration. _ is not a real variable, so you can't declare it.

You should use = instead, when you don't have any new variables.

An update for this question, as of Go 1.4 (current tip), you can use for range flag.Args() { ... } directly skipping the _ = part.