Go golang, syntax error: unexpected ++, expecting :

后端 未结 4 840
醉梦人生
醉梦人生 2021-02-01 13:10
  func test(args ...string) {
    var msg map[string] interface{}

    i := 0
    msg[\"product\"] = args[i++]
    msg[\"key\"] = args[i++]
    msg[\"signature\"] = args         


        
4条回答
  •  清歌不尽
    2021-02-01 13:52

    According to Language Specification, http://golang.org/ref/spec#IncDec_statements, i++ is a IncDec statements, which is a statement, but not a expression.As for args[index], index must be a expression. You want more details , just read it Go Language Specification, it's just what the language demand.

提交回复
热议问题