Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sourcegraph/go-template-lint
Linter for Go text/template (and html/template) template files
https://github.com/sourcegraph/go-template-lint
Last synced: 3 months ago
JSON representation
Linter for Go text/template (and html/template) template files
- Host: GitHub
- URL: https://github.com/sourcegraph/go-template-lint
- Owner: sourcegraph
- License: mit
- Created: 2014-11-10T01:09:49.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2024-06-01T23:25:10.000Z (5 months ago)
- Last Synced: 2024-06-19T00:38:47.442Z (5 months ago)
- Language: Go
- Size: 5.86 KB
- Stars: 41
- Watchers: 85
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-template-lint
`go-template-lint` is a linter for Go
[text/template](http://golang.org/pkg/text/template/) (and
html/template) template files.## Checks
* unused template functions (e.g., your `FuncMap` defines `f` but none
of your templates call it)## Usage
```
go get sourcegraph.com/sourcegraph/go-template-lint
go-template-lint -f= -t= -td=
```The `file-with-FuncMap.go` option should be a Go source file that
contains a `FuncMap` literal, such as:```
package fooimport "text/template" // html/template and/or other import aliases are also detected
// ...
// can be nested in any block
template.FuncMap{
"f": myFunc,
"g": func(v string) string { /* ... */ },
}
// ...
```The `file-with-template-[][]string-list.go` option should be a Go
source file that contains a list of top-level templates and other
template files (relative to the Go file) to include, such as:```
package foo// ...
// can be nested in any block
[][]string{
{"profile.html", "common.html", "layout.html"},
{"edit.html", "common.html", "layout.html"},
}
// ...
```The `base-template-dir` should be the directory that contains your Go
templates and that the template filenames in your code are relative
to. For example, if the template files above (profile,html,
common.html, etc.) were stored in `app/templates`, we'd use
`-td=app/templates`.