From cf7cfa9d4b48256ec47f14a99242095471179d0f Mon Sep 17 00:00:00 2001 From: Eggbertx Date: Mon, 30 Mar 2020 09:14:43 -0700 Subject: [PATCH] Remove unnecessary template functions Also don't fail if strip fails (for example if it's an incompatible binary format) Also also use proper switch fallthrough --- Makefile | 2 +- src/template.go | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index b2876ae2..c060687d 100644 --- a/Makefile +++ b/Makefile @@ -97,7 +97,7 @@ release: cp sample-configs/*.nginx ${RELEASE_DIR}/sample-configs/ cp sample-configs/gochan.example.json ${RELEASE_DIR}/sample-configs/ make build - strip ${BINEXE} + -strip ${BINEXE} make sass-minified mv ${BINEXE} ${RELEASE_DIR}/ ifeq (${GCOS_NAME},macos) diff --git a/src/template.go b/src/template.go index e9adf957..5d65b5ea 100755 --- a/src/template.go +++ b/src/template.go @@ -74,14 +74,6 @@ var funcMap = template.FuncMap{ return fmt.Sprintf("%0.2f GB", size/1024/1024/1024) }, "formatTimestamp": humanReadableTime, - "errorf": func(format string, a ...interface{}) string { - gclog.Printf(lErrorLog, format, a...) - return "" - }, - "print": func(v int, i ...interface{}) string { - gclog.Print(lErrorLog, i...) - return "" - }, "stringAppend": func(strings ...string) string { var appended string for _, str := range strings { @@ -184,10 +176,15 @@ var funcMap = template.FuncMap{ var uploadType string switch extension { case "": + fallthrough case "deleted": uploadType = "" case "webm": + fallthrough case "jpg": + fallthrough + case "jpeg": + fallthrough case "gif": uploadType = "jpg" case "png":