LoginSignup
0
0

More than 3 years have passed since last update.

golangのtemplateで「no such template "xxx"」

Posted at

テンプレートの定義がない

{{define "xxx"}}の定義がない場合が多いので、宣言されているかタイポしていないか確認する

関数の呼び出しミス

関数の呼び出しの部分を間違っていても、発生する(関数は自分でfunctionAと定義をした関数)

(正しい定義).go
{{functionA .Name}}
(間違った定義).go
{{FuncionA .Name}}

呼び出している定義に関わらず読み込みを行なっているディレクトリに影響がでるため注意が必要。

エラーのあるファイル以降のテンプレートが読み込めない現象になる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0