Use consts for route names and templates.
This commit is contained in:
parent
a787d5dc7f
commit
60c8aefd49
30 changed files with 135 additions and 82 deletions
|
|
@ -39,7 +39,7 @@ func GetFuncMap() template.FuncMap {
|
|||
}
|
||||
|
||||
// HasField checks if an interface contains a given field
|
||||
func HasField(v interface{}, name string) bool {
|
||||
func HasField(v any, name string) bool {
|
||||
rv := reflect.ValueOf(v)
|
||||
if rv.Kind() == reflect.Ptr {
|
||||
rv = rv.Elem()
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ func TestLink(t *testing.T) {
|
|||
assert.Equal(t, expected, link)
|
||||
}
|
||||
|
||||
func TestGetFuncMap(t *testing.T) {
|
||||
func TestFile(t *testing.T) {
|
||||
file := File("test.png")
|
||||
expected := fmt.Sprintf("/%s/test.png?v=%s", config.StaticPrefix, CacheBuster)
|
||||
assert.Equal(t, expected, file)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue