Add Go Template and differentiate from Smarty by trewallier · Pull Request #7687 · github-linguist/linguist · GitHub
Skip to content

Add Go Template and differentiate from Smarty#7687

Merged
lildude merged 3 commits into
github-linguist:mainfrom
trewallier:gotpl
Dec 10, 2025
Merged

Add Go Template and differentiate from Smarty#7687
lildude merged 3 commits into
github-linguist:mainfrom
trewallier:gotpl

Conversation

@trewallier

@trewallier trewallier commented Nov 27, 2025

Copy link
Copy Markdown
Contributor

Description

Add Go template as a new language.
This PR is intended to solve #7639 and #6196 so that Helm chart repositories are classified correctly.
Note that Go template use braces similarly to Jinja {{ }} and the file extension might not differentiate template languages in general. So this PR focus only on Smarty - Go template differences as they usually share the same extension in Helm charts.

Rationale for added extensions:

  • .gohtml: IntelliJ IDEA has association with this extension. (link to source)
  • .html.tmpl: GitHub search verifies that is widely used. Mentioned in a StackOverflow answer and also default in a Prettier plugin.
  • .gotmpl, .tmpl: Default extensions of Go template files the Go language server (gopls) (link to documentation). Also the VS Code Go Plugin use this default (link to docs).
  • .tpl: Convention used in Helm charts as stated by the Helm documentation ("Conventionally, Helm charts put [...] templates inside of a partials file, usually _helpers.tpl")

Since none of the extensions are defined by the Go template documentation, and none of the supporting tools stick to one particular default, I left the list in alphabetical order in the languages.yml config.

Checklist:

@trewallier trewallier requested a review from a team as a code owner November 27, 2025 11:38

@lildude lildude left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Along with the inline comments, we also need a sample and supporting search string for all extensions you are adding support for. Any one extension that doesn't meet usage requirements will block this PR from being merged until it does so it's best to start small and add support later as usage grows. Users can use an override in the mean time.

Comment thread lib/linguist/languages.yml
Comment thread lib/linguist/languages.yml Outdated
@trewallier trewallier marked this pull request as draft November 27, 2025 17:16
@trewallier

trewallier commented Nov 27, 2025

Copy link
Copy Markdown
Contributor Author

@trewallier trewallier marked this pull request as ready for review November 27, 2025 21:02
@trewallier trewallier requested a review from lildude December 3, 2025 08:18
@trewallier

Copy link
Copy Markdown
Contributor Author

@lildude lildude left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

Important

The changes in this PR will not appear on GitHub until the next release has been made and deployed. See here for more details.

@lildude lildude added this pull request to the merge queue Dec 10, 2025
Merged via the queue into github-linguist:main with commit 4b4357b Dec 10, 2025
5 checks passed
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Apr 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants