Skip to content

Commit

Permalink
Fixed: Checking all errors
Browse files Browse the repository at this point in the history
  • Loading branch information
agnivade committed May 28, 2019
1 parent 5f8f7ef commit 43fece3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion handler.go
Expand Up @@ -64,7 +64,12 @@ func (ws *wasmServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
ws.logger.Println(err)
return
}
defer f.Close()
defer func() {
err := f.Close()
if err != nil {
ws.logger.Println(err)
}
}()
http.ServeContent(w, r, r.URL.Path, time.Now(), f)
case "/wasm_exec.js":
w.Header().Set("Content-Type", "application/javascript")
Expand Down
5 changes: 4 additions & 1 deletion main.go
Expand Up @@ -26,7 +26,10 @@ func main() {
// net/http code does not take js/wasm path if it is a .test binary.
if ext == ".test" {
wasmFile = strings.Replace(wasmFile, ext, ".wasm", -1)
os.Rename(os.Args[1], wasmFile)
err := os.Rename(os.Args[1], wasmFile)
if err != nil {
logger.Fatal(err)
}
os.Args[1] = wasmFile
}

Expand Down

0 comments on commit 43fece3

Please sign in to comment.