Search code examples
gotemplate-engine

Are Go HTML template file extension names arbitrary?


I see different people naming HTML files index.html or index.tmpl. Both seem to work the same, what's the difference? I see no official documentation about it. Can extension names just be chosen arbitrarily?


Solution

  • The file parsing function and method expect full file names. The template package does not impose any restrictions or make any assumptions about the extensions used in the file names.