func test(args ...string) {
var msg map[string] interface{}
i := 0
msg["product"] = args[i++]
msg["key"] = args[i++]
msg["signature"] = args[i++]
msg["string_to_sign"] = args[i++]
}
go build utils.go
derleme sonra, ben dilimin endeksinde ++Git golang, sözdizimi hatası: beklenmeyen ++, bekliyor:
./utils.go:28: syntax error: unexpected ++, expecting :
./utils.go:28: missing statement after label
./utils.go:29: syntax error: unexpected ++, expecting :
./utils.go:30: syntax error: unexpected ++, expecting :
./utils.go:31: syntax error: unexpected ++, expecting :
./utils.go:36: syntax error: unexpected ++, expecting :
./utils.go:37: syntax error: unexpected ++, expecting :
neden koyamazsınız hata mesajı alıyorum? dilim indeksinde herhangi bir sınırlama var mı?
1. Sadece i ++ 'i kullanabilirsiniz, sadece i + = 1' e gerek yoktur. 2. Bu özel kod için mutlak "i" kullanmanıza gerek yoktur. http://play.golang.org/p/6h1kMGl8xe – OneOfOne
Teşekkürler, anlayın. – HardySimpson