Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: experimental/webtry/webtry.go

Issue 642243004: webtry: Simplify template construction. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/webtry/webtry.go
diff --git a/experimental/webtry/webtry.go b/experimental/webtry/webtry.go
index e7269bbf03835f1774acb33e51ce28799146d56d..99c19cad12190c4f9966d0f72ea134d90d7948a1 100644
--- a/experimental/webtry/webtry.go
+++ b/experimental/webtry/webtry.go
@@ -146,55 +146,37 @@ func init() {
}
os.Chdir(cwd)
- codeTemplate, err = template.ParseFiles(filepath.Join(cwd, "templates/template.cpp"))
- if err != nil {
- panic(err)
- }
- gypTemplate, err = template.ParseFiles(filepath.Join(cwd, "templates/template.gyp"))
- if err != nil {
- panic(err)
- }
- indexTemplate, err = htemplate.ParseFiles(
+ codeTemplate = template.Must(template.ParseFiles(filepath.Join(cwd, "templates/template.cpp")))
+ gypTemplate = template.Must(template.ParseFiles(filepath.Join(cwd, "templates/template.gyp")))
+ indexTemplate = htemplate.Must(htemplate.ParseFiles(
filepath.Join(cwd, "templates/index.html"),
filepath.Join(cwd, "templates/titlebar.html"),
filepath.Join(cwd, "templates/sidebar.html"),
filepath.Join(cwd, "templates/content.html"),
filepath.Join(cwd, "templates/headercommon.html"),
filepath.Join(cwd, "templates/footercommon.html"),
- )
- if err != nil {
- panic(err)
- }
- iframeTemplate, err = htemplate.ParseFiles(
+ ))
+ iframeTemplate = htemplate.Must(htemplate.ParseFiles(
filepath.Join(cwd, "templates/iframe.html"),
filepath.Join(cwd, "templates/content.html"),
filepath.Join(cwd, "templates/headercommon.html"),
filepath.Join(cwd, "templates/footercommon.html"),
- )
- if err != nil {
- panic(err)
- }
- recentTemplate, err = htemplate.ParseFiles(
+ ))
+ recentTemplate = htemplate.Must(htemplate.ParseFiles(
filepath.Join(cwd, "templates/recent.html"),
filepath.Join(cwd, "templates/titlebar.html"),
filepath.Join(cwd, "templates/sidebar.html"),
filepath.Join(cwd, "templates/headercommon.html"),
filepath.Join(cwd, "templates/footercommon.html"),
- )
- if err != nil {
- panic(err)
- }
- workspaceTemplate, err = htemplate.ParseFiles(
+ ))
+ workspaceTemplate = htemplate.Must(htemplate.ParseFiles(
filepath.Join(cwd, "templates/workspace.html"),
filepath.Join(cwd, "templates/titlebar.html"),
filepath.Join(cwd, "templates/sidebar.html"),
filepath.Join(cwd, "templates/content.html"),
filepath.Join(cwd, "templates/headercommon.html"),
filepath.Join(cwd, "templates/footercommon.html"),
- )
- if err != nil {
- panic(err)
- }
+ ))
// The git command returns output of the format:
//
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698