【发布时间】:2014-05-21 19:55:00
【问题描述】:
在代码里面,我尝试做一些操作
is_html := false;
// Check, if HTMl is exist
for i := 0; i < len(modules_arr); i++ {
if modules_arr[i] == "html" { is_html := true }
}
if is_html ==true
{
fmt.Printf("%v", "asdasd")
}
但我得到一个错误:
./api.go:26: missing condition in if statement
./api.go:26: is_html == true evaluated but not used
Error: process exited with code 2.
【问题讨论】:
-
请先使用
go fmt正确格式化您的代码。 -
is_html := true应该是is_html = true注意缺少: -
我已经回滚了对更改格式的这个问题的编辑,因为当他修复格式时问题就消失了。