diff --git a/caddyhttp/browse/browse_test.go b/caddyhttp/browse/browse_test.go
index 2c494538f..08eebe27f 100644
--- a/caddyhttp/browse/browse_test.go
+++ b/caddyhttp/browse/browse_test.go
@@ -290,18 +290,19 @@ func TestBrowseJson(t *testing.T) {
 	for i, test := range tests {
 		var marsh []byte
 		req, err := http.NewRequest("GET", "/photos"+test.QueryURL, nil)
-
-		if err == nil && test.shouldErr {
-			t.Errorf("Test %d didn't error, but it should have", i)
-		} else if err != nil && !test.shouldErr {
-			t.Errorf("Test %d errored, but it shouldn't have; got '%v'", i, err)
+		if err != nil && !test.shouldErr {
+			t.Errorf("Test %d errored when making request, but it shouldn't have; got '%v'", i, err)
 		}
 
 		req.Header.Set("Accept", "application/json")
 		rec := httptest.NewRecorder()
 
 		code, err := b.ServeHTTP(rec, req)
-
+		if err == nil && test.shouldErr {
+			t.Errorf("Test %d didn't error, but it should have", i)
+		} else if err != nil && !test.shouldErr {
+			t.Errorf("Test %d errored, but it shouldn't have; got '%v'", i, err)
+		}
 		if code != http.StatusOK {
 			t.Fatalf("In test %d: Wrong status, expected %d, got %d", i, http.StatusOK, code)
 		}
diff --git a/caddyhttp/fastcgi/fcgiclient.go b/caddyhttp/fastcgi/fcgiclient.go
index f443f63d9..9ee660921 100644
--- a/caddyhttp/fastcgi/fcgiclient.go
+++ b/caddyhttp/fastcgi/fcgiclient.go
@@ -546,6 +546,9 @@ func (c *FCGIClient) PostFile(p map[string]string, data url.Values, file map[str
 			return nil, e
 		}
 		_, err = io.Copy(part, fd)
+		if err != nil {
+			return
+		}
 	}
 
 	err = writer.Close()
diff --git a/caddyhttp/staticfiles/fileserver.go b/caddyhttp/staticfiles/fileserver.go
index 99ef406aa..41fe2d494 100644
--- a/caddyhttp/staticfiles/fileserver.go
+++ b/caddyhttp/staticfiles/fileserver.go
@@ -103,7 +103,6 @@ func (fs FileServer) serveFile(w http.ResponseWriter, r *http.Request, name stri
 				defer ff.Close()
 				dd, err := ff.Stat()
 				if err == nil {
-					name = index
 					d = dd
 					f = ff
 					break
diff --git a/caddyhttp/staticfiles/fileserver_test.go b/caddyhttp/staticfiles/fileserver_test.go
index 6c77cec1a..28855e66b 100644
--- a/caddyhttp/staticfiles/fileserver_test.go
+++ b/caddyhttp/staticfiles/fileserver_test.go
@@ -163,6 +163,9 @@ func TestServeHTTP(t *testing.T) {
 	for i, test := range tests {
 		responseRecorder := httptest.NewRecorder()
 		request, err := http.NewRequest("GET", test.url, nil)
+		if err != nil {
+			t.Errorf("Test %d: Error making request: %v", i, err)
+		}
 		// prevent any URL sanitization within Go: we need unmodified paths here
 		if u, _ := url.Parse(test.url); u.RawPath != "" {
 			request.URL.Path = u.RawPath
diff --git a/caddytls/client.go b/caddytls/client.go
index 973931956..f3cae1be9 100644
--- a/caddytls/client.go
+++ b/caddytls/client.go
@@ -56,6 +56,9 @@ var newACMEClient = func(config *Config, allowPrompts bool) (*ACMEClient, error)
 		caURL = "https://" + caURL
 	}
 	u, err := url.Parse(caURL)
+	if err != nil {
+		return nil, err
+	}
 	if u.Scheme != "https" && !caddy.IsLoopback(u.Host) && !strings.HasPrefix(u.Host, "10.") {
 		return nil, fmt.Errorf("%s: insecure CA URL (HTTPS required)", caURL)
 	}