webtry: Check the result of os.Chdir().
As mentioned in http://golang.org/doc/effective_go.html#blank_assign,
errors are provided for a reason, so always check them.
The documentation for this function is available at
http://golang.org/pkg/os/#Chdir.
BUG=None
TEST=None
R=jcgregorio@google.com
Review URL: https://codereview.chromium.org/651343002
diff --git a/experimental/webtry/webtry.go b/experimental/webtry/webtry.go
index e644d13..9f7b47e 100644
--- a/experimental/webtry/webtry.go
+++ b/experimental/webtry/webtry.go
@@ -139,12 +139,13 @@
rand.Seed(time.Now().UnixNano())
// Change the current working directory to the directory of the executable.
- var err error
cwd, err := filepath.Abs(filepath.Dir(os.Args[0]))
if err != nil {
log.Fatal(err)
}
- os.Chdir(cwd)
+ if err := os.Chdir(cwd); err != nil {
+ log.Fatal(err)
+ }
codeTemplate = template.Must(template.ParseFiles(filepath.Join(cwd, "templates/template.cpp")))
gypTemplate = template.Must(template.ParseFiles(filepath.Join(cwd, "templates/template.gyp")))