私は非常に厄介な問題に遭遇しました。問題の原因を突き止めるのに約 1 時間かかりましたが、理由はわかりません。
私はhtml/template
Web ページのレンダリングに使用していますが、コードは次のようになります。
t, _ := template.parseFiles("template/index.tmpl")
...
t.Execute(w, modelView) // w is a http.ResponseWriter and modelView is a data struct.
しかし、無意識のうちに、<textarea>
タグを開いたままにするミスを犯しました。
<html>
<body>
<form id="batchAddUser" class="form-inline">
**this one** --> <textarea name="users" value="" row=3 placeholder="input username and password splited by space">
<button type="submit" class="btn btn-success" >Add</button>
</form>
</body>
</html>
そして、Go は例外やその他のヒントを提供しませんが、何もない空白のページを提供するだけで、ステータス コードは200
です。
情報が提供されなかったので、問題の特定に効果がありましたが、なぜそれが起こるのでしょうか? colsed されていないタグがどうしてそのような問題を引き起こすのでしょうか? そして、それをデバッグする方法は?