Repository: hetznercloud/hcloud-go
Pull request #162 (2021-02-17 07:52:15)

Add golangci-lint and fix issues
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>


Patch:
diff --git a/.errcheck_excludes.txt b/.errcheck_excludes.txt
new file mode 100644
index 0000000..e69de29
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index dbc8fab..32bab00 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,19 +14,5 @@ jobs:
         go-version: ${{ matrix.go-version }}
     - name: Check out code into the Go module directory
       uses: actions/checkout@v1
-    - name: Get dependencies
-      run: |
-        go get -u golang.org/x/lint/golint
-        go get -v -t -d ./...
-    - name: Run go fmt
-      run: diff -u <(echo -n) <(gofmt -d -s .)
-    - name: Run go vet
-      run: go vet ./...
-    - name: Run go lint
-      run: |
-        # Temporary fix for:
-        # https://github.com/actions/setup-go/issues/14
-        export PATH=$PATH:$(go env GOPATH)/bin
-        golint -set_exit_status .
     - name: Run tests
       run: go test -v ./...
diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml
new file mode 100644
index 0000000..4a7d221
--- /dev/null
+++ b/.github/workflows/golangci-lint.yml
@@ -0,0 +1,32 @@
+name: golangci-lint
+on:
+  push:
+    tags:
+      - v*
+    branches:
+      - master
+      - main
+  pull_request:
+jobs:
+  golangci:
+    name: lint
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: golangci-lint
+        uses: golangci/golangci-lint-action@v2
+        with:
+          # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
+          version: v1.36
+
+          # Optional: working directory, useful for monorepos
+          # working-directory: somedir
+
+          # Optional: golangci-lint command line arguments.
+          # args: --issues-exit-code=0
+
+          # Optional: show only new issues if it's a pull request. The default value is `false`.
+          # only-new-issues: true
+
+          # Optional: if set to true then the action will use pre-installed Go
+          # skip-go-installation: true
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..76444bc
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,27 @@
+stages:
+  - test
+
+variables:
+  GIT_SUBMODULE_STRATEGY: normal
+
+test:golangci-lint:
+  stage: test
+  image: golangci/golangci-lint:v1.36
+  script:
+    - golangci-lint run -v
+  except:
+    - tags
+    - master
+  tags:
+    - hc-bladerunner
+
+test:tests:
+  stage: test
+  image: golang:1.15
+  script:
+    - go test -v -race ./...
+  except:
+    - tags
+    - master
+  tags:
+    - hc-bladerunner
diff --git a/.golangci.yaml b/.golangci.yaml
new file mode 100644
index 0000000..0674a26
--- /dev/null
+++ b/.golangci.yaml
@@ -0,0 +1,43 @@
+---
+linters-settings:
+  errcheck:
+    exclude: ./.errcheck_excludes.txt
+  misspell:
+    locale: "US"
+
+linters:
+  disable-all: true
+  enable:
+    - bodyclose
+    - deadcode
+    - depguard
+    - errcheck
+    - gocritic
+    - goimports
+    - golint
+    - gosec
+    - gosimple
+    - govet
+    - ineffassign
+    - misspell
+    - prealloc
+    - rowserrcheck
+    - scopelint
+    - staticcheck
+    - structcheck
+    - typecheck
+    - unparam
+    - unused
+    - varcheck
+    - whitespace
+
+issues:
+  exclude-rules:
+    - path: _test\.go
+      linters:
+        - gosec
+        - scopelint
+        - errcheck
+    - linters:
+        - gosec
+      text: "G204:"
diff --git a/hcloud/action.go b/hcloud/action.go
index 1a62f8b..f9ff403 100644
--- a/hcloud/action.go
+++ b/hcloud/action.go
@@ -141,7 +141,7 @@ func (c *ActionClient) All(ctx context.Context) ([]*Action, error) {
 	opts := ActionListOpts{}
 	opts.PerPage = 50
 
-	_, err := c.client.all(func(page int) (*Response, error) {
+	err := c.client.all(func(page int) (*Response, error) {
 		opts.Page = page
 		actions, resp, err := c.List(ctx, opts)
 		if err != nil {
@@ -194,7 +194,6 @@ func (c *ActionClient) WatchProgress(ctx context.Context, action *Action) (<-cha
 			switch a.Status {
 			case ActionStatusRunning:
 				sendProgress(a.Progress)
-				break
 			case ActionStatusSuccess:
 				sendProgress(100)
 				errCh <- nil
diff --git a/hcloud/certificate.go b/hcloud/certificate.go
index 5d34f70..a6cb5cc 100644
--- a/hcloud/certificate.go
+++ b/hcloud/certificate.go
@@ -114,7 +114,7 @@ func (c *CertificateClient) All(ctx context.Context) ([]*Certificate, error) {
 	opts := CertificateListOpts{}
 	opts.PerPage = 50
 
-	_, err := c.client.all(func(page int) (*Response, error) {
+	err := c.client.all(func(page int) (*Response, error) {
 		opts.Page = page
 		Certificate, resp, err := c.List(ctx, opts)
 		if err != nil {
@@ -134,7 +134,7 @@ func (c *CertificateClient) All(ctx context.Context) ([]*Certificate, error) {
 func (c *CertificateClient) AllWithOpts(ctx context.Context, opts CertificateListOpts) ([]*Certificate, error) {
 	var allCertificates []*Certificate
 
-	_, err := c.client.all(func(page int) (*Response, error) {
+	err := c.client.all(func(page int) (*Response, error) {
 		opts.Page = page
 		Certificates, resp, err := c.List(ctx, opts)
 		if err != nil {
diff --git a/hcloud/client.go b/hcloud/client.go
index d79b0a8..0736bd4 100644
--- a/hcloud/client.go
+++ b/hcloud/client.go
@@ -240,12 +240,10 @@ func (c *Client) Do(r *http.Request, v interface{}) (*Response, error) {
 			err = errorFromResponse(resp, body)
 			if err == nil {
 				err = fmt.Errorf("hcloud: server responded with status code %d", resp.StatusCode)
-			} else {
-				if isRetryable(err) {
-					c.backoff(retries)
-					retries++
-					continue
-				}
+			} else if isRetryable(err) {
+				c.backoff(retries)
+				retries++
+				continue
 			}
 			return response, err
 		}
@@ -273,17 +271,17 @@ func (c *Client) backoff(retries int) {
 	time.Sleep(c.backoffFunc(retries))
 }
 
-func (c *Client) all(f func(int) (*Response, error)) (*Response, error) {
+func (c *Client) all(f func(int) (*Response, error)) error {
 	var (
 		page = 1
 	)
 	for {
 		resp, err := f(page)
 		if err != nil {
-			return nil, err
+			return err
 		}
 		if resp.Meta.Pagination == nil || resp.Meta.Pagination.NextPage == 0 {
-			return resp, nil
+			return nil
 		}
 		page = resp.Meta.Pagination.NextPage
 	}
diff --git a/hcloud/datacenter.go b/hcloud/datacenter.go
index 272cd6a..ae8b6c6 100644
--- a/hcloud/datacenter.go
+++ b/hcloud/datacenter.go
@@ -112,7 +112,7 @@ func (c *DatacenterClient) All(ctx context.Context) ([]*Datacenter, error) {
 	opts := DatacenterListOpts{}
 	opts.PerPage = 50
 
-	_, err := c.client.all(func(page int) (*Response, error) {
+	err := c.client.all(func(page int) (*Response, error) {
 		opts.Page = page
 		datacenters, resp, err := c.List(ctx, opts)
 		if err != nil {
diff --git a/hcloud/floating_ip.go b/hcloud/floating_ip.go
index 025351f..d8a6d0f 100644
--- a/hcloud/floating_ip.go
+++ b/hcloud/floating_ip.go
@@ -141,7 +141,7 @@ func (c *FloatingIPClient) All(ctx context.Context) ([]*FloatingIP, error) {
 func (c *FloatingIPClient) AllWithOpts(ctx context.Context, opts FloatingIPListOpts) ([]*FloatingIP, error) {
 	allFloatingIPs := []*FloatingIP{}
 
-	_, err := c.client.all(func(page int) (*Response, error) {
+	err := c.client.all(func(page int) (*Response, error) {
 		opts.Page = page
 		floatingIPs, resp, err := c.List(ctx, opts)
 		if err != nil {
diff --git a/hcloud/image.go b/hcloud/image.go
index a0aa18f..87e9271 100644
--- a/hcloud/image.go
+++ b/hcloud/image.go
@@ -176,7 +176,7 @@ func (c *ImageClient) All(ctx context.Context) ([]*Image, error) {
 func (c *ImageClient) AllWithOpts(ctx context.Context, opts ImageListOpts) ([]*Image, error) {
 	allImages := []*Image{}
 
-	_, err := c.client.all(func(page int) (*Response, error) {
+	err := c.client.all(func(page int) (*Response, error) {
 		opts.Page = page
 		images, resp, err := c.List(ctx, opts)
 		if err != nil {
diff --git a/hcloud/iso.go b/hcloud/iso.go
index 18e1610..b3d97ba 100644
--- a/hcloud/iso.go
+++ b/hcloud/iso.go
@@ -122,7 +122,7 @@ func (c *ISOClient) All(ctx context.Context) ([]*ISO, error) {
 	opts := ISOListOpts{}
 	opts.PerPage = 50
 
-	_, err := c.client.all(func(page int) (*Response, error) {
+	err := c.client.all(func(page int) (*Response, error) {
 		opts.Page = page
 		isos, resp, err := c.List(ctx, opts)
 		if err != nil {
diff --git a/hcloud/load_balancer.go b/hcloud/load_balancer.go
index 6de4a36..d395127 100644
--- a/hcloud/load_balancer.go
+++ b/hcloud/load_balancer.go
@@ -283,7 +283,7 @@ func (c *LoadBalancerClient) All(ctx context.Context) ([]*LoadBalancer, error) {
 	opts := LoadBalancerListOpts{}
 	opts.PerPage = 50
 
-	_, err := c.client.all(func(page int) (*Response, error) {
+	err := c.client.all(func(page int) (*Response, error) {
 		opts.Page = page
 		LoadBalancer, resp, err := c.List(ctx, opts)
 		if err != nil {
@@ -303,7 +303,7 @@ func (c *LoadBalancerClient) All(ctx context.Context) ([]*LoadBalancer, error) {
 func (c *LoadBalancerClient) AllWithOpts(ctx context.Context, opts LoadBalancerListOpts) ([]*LoadBalancer, error) {
 	var allLoadBalancers []*LoadBalancer
 
-	_, err := c.client.all(func(page int) (*Response, error) {
+	err := c.client.all(func(page int) (*Response, error) {
 		opts.Page = page
 		LoadBalancers, resp, err := c.List(ctx, opts)
 		if err != nil {
diff --git a/hcloud/load_balancer_type.go b/hcloud/load_balancer_type.go
index 12202d0..7380004 100644
--- a/hcloud/load_balancer_type.go
+++ b/hcloud/load_balancer_type.go
@@ -109,7 +109,7 @@ func (c *LoadBalancerTypeClient) All(ctx context.Context) ([]*LoadBalancerType,
 	opts := LoadBalancerTypeListOpts{}
 	opts.PerPage = 50
 
-	_, err := c.client.all(func(page int) (*Response, error) {
+	err := c.client.all(func(page int) (*Response, error) {
 		opts.Page = page
 		LoadBalancerTypes, resp, err := c.List(ctx, opts)
 		if err != nil {
diff --git a/hcloud/location.go b/hcloud/location.go
index ad2fff8..05f4232 100644
--- a/hcloud/location.go
+++ b/hcloud/location.go
@@ -109,7 +109,7 @@ func (c *LocationClient) All(ctx context.Context) ([]*Location, error) {
 	opts := LocationListOpts{}
 	opts.PerPage = 50
 
-	_, err := c.client.all(func(page int) (*Response, error) {
+	err := c.client.all(func(page int) (*Response, error) {
 		opts.Page = page
 		locations, resp, err := c.List(ctx, opts)
 		if err != nil {
diff --git a/hcloud/network.go b/hcloud/network.go
index 8657592..2f39d85 100644
--- a/hcloud/network.go
+++ b/hcloud/network.go
@@ -155,7 +155,7 @@ func (c *NetworkClient) All(ctx context.Context) ([]*Network, error) {
 func (c *NetworkClient) AllWithOpts(ctx context.Context, opts NetworkListOpts) ([]*Network, error) {
 	var allNetworks []*Network
 
-	_, err := c.client.all(func(page int) (*Response, error) {
+	err := c.client.all(func(page int) (*Response, error) {
 		opts.Page = page
 		Networks, resp, err := c.List(ctx, opts)
 		if err != nil {
diff --git a/hcloud/schema.go b/hcloud/schema.go
index 6a04df0..7edf4a2 100644
--- a/hcloud/schema.go
+++ b/hcloud/schema.go
@@ -40,9 +40,9 @@ func ActionFromSchema(s schema.Action) *Action {
 
 // ActionsFromSchema converts a slice of schema.Action to a slice of Action.
 func ActionsFromSchema(s []schema.Action) []*Action {
-	var actions []*Action
-	for _, a := range s {
-		actions = append(actions, ActionFromSchema(a))
+	actions := make([]*Action, len(s))
+	for i, a := range s {
+		actions[i] = ActionFromSchema(a)
 	}
 	return actions
 }
@@ -583,8 +583,7 @@ func ErrorFromSchema(s schema.Error) Error {
 		Message: s.Message,
 	}
 
-	switch d := s.Details.(type) {
-	case schema.ErrorDetailsInvalidInput:
+	if d, ok := s.Details.(schema.ErrorDetailsInvalidInput); ok {
 		details := ErrorDetailsInvalidInput{
 			Fields: []ErrorDetailsInvalidInputField{},
 		}
diff --git a/hcloud/schema/error.go b/hcloud/schema/error.go
index 6bcb6ec..2d5cf5d 100644
--- a/hcloud/schema/error.go
+++ b/hcloud/schema/error.go
@@ -17,8 +17,7 @@ func (e *Error) UnmarshalJSON(data []byte) (err error) {
 	if err = json.Unmarshal(data, alias); err != nil {
 		return
 	}
-	switch e.Code {
-	case "invalid_input":
+	if e.Code == "invalid_input" {
 		details := ErrorDetailsInvalidInput{}
 		if err = json.Unmarshal(e.DetailsRaw, &details); err != nil {
 			return
diff --git a/hcloud/server.go b/hcloud/server.go
index 5993d83..13f66bc 100644
--- a/hcloud/server.go
+++ b/hcloud/server.go
@@ -215,7 +215,7 @@ func (c *ServerClient) All(ctx context.Context) ([]*Server, error) {
 func (c *ServerClient) AllWithOpts(ctx context.Context, opts ServerListOpts) ([]*Server, error) {
 	allServers := []*Server{}
 
-	_, err := c.client.all(func(page int) (*Response, error) {
+	err := c.client.all(func(page int) (*Response, error) {
 		opts.Page = page
 		servers, resp, err := c.List(ctx, opts)
 		if err != nil {
diff --git a/hcloud/server_type.go b/hcloud/server_type.go
index 043945f..a681d09 100644
--- a/hcloud/server_type.go
+++ b/hcloud/server_type.go
@@ -40,7 +40,7 @@ const (
 	// CPUTypeShared is the type for shared CPU.
 	CPUTypeShared CPUType = "shared"
 
-	//CPUTypeDedicated is the type for dedicated CPU.
+	// CPUTypeDedicated is the type for dedicated CPU.
 	CPUTypeDedicated CPUType = "dedicated"
 )
 
@@ -132,7 +132,7 @@ func (c *ServerTypeClient) All(ctx context.Context) ([]*ServerType, error) {
 	opts := ServerTypeListOpts{}
 	opts.PerPage = 50
 
-	_, err := c.client.all(func(page int) (*Response, error) {
+	err := c.client.all(func(page int) (*Response, error) {
 		opts.Page = page
 		serverTypes, resp, err := c.List(ctx, opts)
 		if err != nil {
diff --git a/hcloud/ssh_key.go b/hcloud/ssh_key.go
index f5be20b..52195e7 100644
--- a/hcloud/ssh_key.go
+++ b/hcloud/ssh_key.go
@@ -126,7 +126,7 @@ func (c *SSHKeyClient) All(ctx context.Context) ([]*SSHKey, error) {
 func (c *SSHKeyClient) AllWithOpts(ctx context.Context, opts SSHKeyListOpts) ([]*SSHKey, error) {
 	allSSHKeys := []*SSHKey{}
 
-	_, err := c.client.all(func(page int) (*Response, error) {
+	err := c.client.all(func(page int) (*Response, error) {
 		opts.Page = page
 		sshKeys, resp, err := c.List(ctx, opts)
 		if err != nil {
diff --git a/hcloud/volume.go b/hcloud/volume.go
index fd32271..5355936 100644
--- a/hcloud/volume.go
+++ b/hcloud/volume.go
@@ -137,7 +137,7 @@ func (c *VolumeClient) All(ctx context.Context) ([]*Volume, error) {
 func (c *VolumeClient) AllWithOpts(ctx context.Context, opts VolumeListOpts) ([]*Volume, error) {
 	allVolumes := []*Volume{}
 
-	_, err := c.client.all(func(page int) (*Response, error) {
+	err := c.client.all(func(page int) (*Response, error) {
 		opts.Page = page
 		volumes, resp, err := c.List(ctx, opts)
 		if err != nil {


Test patch:
diff --git a/hcloud/action_test.go b/hcloud/action_test.go
index 2dccf88..e9bca52 100644
--- a/hcloud/action_test.go
+++ b/hcloud/action_test.go
@@ -15,7 +15,7 @@ func TestActionClientGetByID(t *testing.T) {
 	defer env.Teardown()
 
 	env.Mux.HandleFunc("/actions/1", func(w http.ResponseWriter, r *http.Request) {
-		json.NewEncoder(w).Encode(schema.ActionGetResponse{
+		_ = json.NewEncoder(w).Encode(schema.ActionGetResponse{
 			Action: schema.Action{
 				ID:       1,
 				Status:   "running",
@@ -46,7 +46,7 @@ func TestActionClientGetByIDNotFound(t *testing.T) {
 	env.Mux.HandleFunc("/actions/1", func(w http.ResponseWriter, r *http.Request) {
 		w.Header().Set("Content-Type", "application/json")
 		w.WriteHeader(http.StatusNotFound)
-		json.NewEncoder(w).Encode(schema.ErrorResponse{
+		_ = json.NewEncoder(w).Encode(schema.ErrorResponse{
 			Error: schema.Error{
 				Code: string(ErrorCodeNotFound),
 			},
@@ -101,7 +101,7 @@ func TestActionClientList(t *testing.T) {
 				t.Errorf("expected sort[2] to be command:asc; got %q", sort[2])
 			}
 		}
-		json.NewEncoder(w).Encode(schema.ActionListResponse{
+		_ = json.NewEncoder(w).Encode(schema.ActionListResponse{
 			Actions: []schema.Action{
 				{ID: 1},
 				{ID: 2},
@@ -131,7 +131,7 @@ func TestActionClientAll(t *testing.T) {
 
 	env.Mux.HandleFunc("/actions", func(w http.ResponseWriter, r *http.Request) {
 		w.Header().Set("Content-Type", "application/json")
-		json.NewEncoder(w).Encode(struct {
+		_ = json.NewEncoder(w).Encode(struct {
 			Actions []schema.Action `json:"actions"`
 			Meta    schema.Meta     `json:"meta"`
 		}{
@@ -174,7 +174,7 @@ func TestActionClientWatchProgress(t *testing.T) {
 		w.Header().Set("Content-Type", "application/json")
 		switch callCount {
 		case 1:
-			json.NewEncoder(w).Encode(schema.ActionGetResponse{
+			_ = json.NewEncoder(w).Encode(schema.ActionGetResponse{
 				Action: schema.Action{
 					ID:       1,
 					Status:   "running",
@@ -183,7 +183,7 @@ func TestActionClientWatchProgress(t *testing.T) {
 			})
 		case 2:
 			w.WriteHeader(http.StatusTooManyRequests)
-			json.NewEncoder(w).Encode(schema.ErrorResponse{
+			_ = json.NewEncoder(w).Encode(schema.ErrorResponse{
 				Error: schema.Error{
 					Code:    string(ErrorCodeRateLimitExceeded),
 					Message: "ratelimited",
@@ -191,7 +191,7 @@ func TestActionClientWatchProgress(t *testing.T) {
 			})
 			return
 		case 3:
-			json.NewEncoder(w).Encode(schema.ActionGetResponse{
+			_ = json.NewEncoder(w).Encode(schema.ActionGetResponse{
 				Action: schema.Action{
 					ID:       1,
 					Status:   "error",
@@ -247,7 +247,7 @@ func TestActionClientWatchProgressError(t *testing.T) {
 	env.Mux.HandleFunc("/actions/1", func(w http.ResponseWriter, r *http.Request) {
 		w.Header().Set("Content-Type", "application/json")
 		w.WriteHeader(http.StatusUnprocessableEntity)
-		json.NewEncoder(w).Encode(schema.ErrorResponse{
+		_ = json.NewEncoder(w).Encode(schema.ErrorResponse{
 			Error: schema.Error{
 				Code:    string(ErrorCodeServiceError),
 				Message: "service error",
diff --git a/hcloud/certificate_test.go b/hcloud/certificate_test.go
index 4317d99..273af07 100644
--- a/hcloud/certificate_test.go
+++ b/hcloud/certificate_test.go
@@ -269,9 +269,7 @@ func TestCertificateDelete(t *testing.T) {
 	env := newTestEnv()
 	defer env.Teardown()
 
-	env.Mux.HandleFunc("/certificates/1", func(w http.ResponseWriter, r *http.Request) {
-		return
-	})
+	env.Mux.HandleFunc("/certificates/1", func(w http.ResponseWriter, r *http.Request) {})
 
 	var (
 		ctx        = context.Background()
diff --git a/hcloud/client_test.go b/hcloud/client_test.go
index 6fb73d3..f27f403 100644
--- a/hcloud/client_test.go
+++ b/hcloud/client_test.go
@@ -60,7 +60,7 @@ func TestClientError(t *testing.T) {
 		json.NewEncoder(w).Encode(schema.ErrorResponse{
 			Error: schema.Error{
 				Code:    "service_error",
-				Message: "An error occured",
+				Message: "An error occurred",
 			},
 		})
 	})
@@ -81,7 +81,7 @@ func TestClientError(t *testing.T) {
 	if apiError.Code != "service_error" {
 		t.Errorf("unexpected error code: %q", apiError.Code)
 	}
-	if apiError.Message != "An error occured" {
+	if apiError.Message != "An error occurred" {
 		t.Errorf("unexpected error message: %q", apiError.Message)
 	}
 }
@@ -210,7 +210,7 @@ func TestClientAll(t *testing.T) {
 		json.NewEncoder(w).Encode(respBody)
 	})
 
-	env.Client.all(func(page int) (*Response, error) {
+	_ = env.Client.all(func(page int) (*Response, error) {
 		if page != expectedPage {
 			t.Fatalf("expected page %d, but called for %d", expectedPage, page)
 		}
diff --git a/hcloud/floating_ip_test.go b/hcloud/floating_ip_test.go
index 97a3c27..eafcc85 100644
--- a/hcloud/floating_ip_test.go
+++ b/hcloud/floating_ip_test.go
@@ -317,9 +317,7 @@ func TestFloatingIPClientDelete(t *testing.T) {
 	env := newTestEnv()
 	defer env.Teardown()
 
-	env.Mux.HandleFunc("/floating_ips/1", func(w http.ResponseWriter, r *http.Request) {
-		return
-	})
+	env.Mux.HandleFunc("/floating_ips/1", func(w http.ResponseWriter, r *http.Request) {})
 
 	var (
 		ctx        = context.Background()
diff --git a/hcloud/image_test.go b/hcloud/image_test.go
index c9ccac7..6a339c0 100644
--- a/hcloud/image_test.go
+++ b/hcloud/image_test.go
@@ -293,9 +293,7 @@ func TestImageClient(t *testing.T) {
 		env := newTestEnv()
 		defer env.Teardown()
 
-		env.Mux.HandleFunc("/images/1", func(w http.ResponseWriter, r *http.Request) {
-			return
-		})
+		env.Mux.HandleFunc("/images/1", func(w http.ResponseWriter, r *http.Request) {})
 
 		var (
 			ctx   = context.Background()
diff --git a/hcloud/load_balancer_test.go b/hcloud/load_balancer_test.go
index c223249..5d54b0e 100644
--- a/hcloud/load_balancer_test.go
+++ b/hcloud/load_balancer_test.go
@@ -220,9 +220,7 @@ func TestLoadBalancerDelete(t *testing.T) {
 	env := newTestEnv()
 	defer env.Teardown()
 
-	env.Mux.HandleFunc("/load_balancers/1", func(w http.ResponseWriter, r *http.Request) {
-		return
-	})
+	env.Mux.HandleFunc("/load_balancers/1", func(w http.ResponseWriter, r *http.Request) {})
 
 	var (
 		ctx          = context.Background()
@@ -1038,14 +1036,14 @@ func TestLoadBalancerGetMetrics(t *testing.T) {
 					LoadBalancerMetricRequestsPerSecond,
 					LoadBalancerMetricBandwidth,
 				},
-				Start: mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z"),
-				End:   mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z"),
+				Start: mustParseTime(t, "2017-01-01T00:00:00Z"),
+				End:   mustParseTime(t, "2017-01-01T23:00:00Z"),
 			},
 			respFn: func() schema.LoadBalancerGetMetricsResponse {
 				var resp schema.LoadBalancerGetMetricsResponse
 
-				resp.Metrics.Start = mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z")
-				resp.Metrics.End = mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z")
+				resp.Metrics.Start = mustParseTime(t, "2017-01-01T00:00:00Z")
+				resp.Metrics.End = mustParseTime(t, "2017-01-01T23:00:00Z")
 				resp.Metrics.TimeSeries = map[string]schema.LoadBalancerTimeSeriesVals{
 					"open_connections": {
 						Values: []interface{}{
@@ -1082,8 +1080,8 @@ func TestLoadBalancerGetMetrics(t *testing.T) {
 				return resp
 			},
 			expected: LoadBalancerMetrics{
-				Start: mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z"),
-				End:   mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z"),
+				Start: mustParseTime(t, "2017-01-01T00:00:00Z"),
+				End:   mustParseTime(t, "2017-01-01T23:00:00Z"),
 				TimeSeries: map[string][]LoadBalancerMetricsValue{
 					"open_connections": {
 						{Timestamp: 1435781470.622, Value: "42"},
@@ -1112,8 +1110,8 @@ func TestLoadBalancerGetMetrics(t *testing.T) {
 			name: "missing metrics types",
 			lb:   &LoadBalancer{ID: 3},
 			opts: LoadBalancerGetMetricsOpts{
-				Start: mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z"),
-				End:   mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z"),
+				Start: mustParseTime(t, "2017-01-01T00:00:00Z"),
+				End:   mustParseTime(t, "2017-01-01T23:00:00Z"),
 			},
 			expectedErr: "add query params: no metric types specified",
 		},
@@ -1122,7 +1120,7 @@ func TestLoadBalancerGetMetrics(t *testing.T) {
 			lb:   &LoadBalancer{ID: 4},
 			opts: LoadBalancerGetMetricsOpts{
 				Types: []LoadBalancerMetricType{LoadBalancerMetricBandwidth},
-				End:   mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z"),
+				End:   mustParseTime(t, "2017-01-01T23:00:00Z"),
 			},
 			expectedErr: "add query params: no start time specified",
 		},
@@ -1131,7 +1129,7 @@ func TestLoadBalancerGetMetrics(t *testing.T) {
 			lb:   &LoadBalancer{ID: 5},
 			opts: LoadBalancerGetMetricsOpts{
 				Types: []LoadBalancerMetricType{LoadBalancerMetricBandwidth},
-				Start: mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z"),
+				Start: mustParseTime(t, "2017-01-01T00:00:00Z"),
 			},
 			expectedErr: "add query params: no end time specified",
 		},
@@ -1140,8 +1138,8 @@ func TestLoadBalancerGetMetrics(t *testing.T) {
 			lb:   &LoadBalancer{ID: 6},
 			opts: LoadBalancerGetMetricsOpts{
 				Types: []LoadBalancerMetricType{LoadBalancerMetricBandwidth},
-				Start: mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z"),
-				End:   mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z"),
+				Start: mustParseTime(t, "2017-01-01T00:00:00Z"),
+				End:   mustParseTime(t, "2017-01-01T23:00:00Z"),
 			},
 			respStatus:  http.StatusInternalServerError,
 			expectedErr: "get metrics: hcloud: server responded with status code 500",
@@ -1150,8 +1148,8 @@ func TestLoadBalancerGetMetrics(t *testing.T) {
 			name: "no load balancer passed",
 			opts: LoadBalancerGetMetricsOpts{
 				Types: []LoadBalancerMetricType{LoadBalancerMetricBandwidth},
-				Start: mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z"),
-				End:   mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z"),
+				Start: mustParseTime(t, "2017-01-01T00:00:00Z"),
+				End:   mustParseTime(t, "2017-01-01T23:00:00Z"),
 			},
 			expectedErr: "illegal argument: load balancer is nil",
 		},
diff --git a/hcloud/network_test.go b/hcloud/network_test.go
index 9f60639..5b0855b 100644
--- a/hcloud/network_test.go
+++ b/hcloud/network_test.go
@@ -219,9 +219,7 @@ func TestNetworkDelete(t *testing.T) {
 	env := newTestEnv()
 	defer env.Teardown()
 
-	env.Mux.HandleFunc("/networks/1", func(w http.ResponseWriter, r *http.Request) {
-		return
-	})
+	env.Mux.HandleFunc("/networks/1", func(w http.ResponseWriter, r *http.Request) {})
 
 	var (
 		ctx     = context.Background()
diff --git a/hcloud/schema_test.go b/hcloud/schema_test.go
index 05de0fc..700621f 100644
--- a/hcloud/schema_test.go
+++ b/hcloud/schema_test.go
@@ -166,7 +166,6 @@ func TestFloatingIPFromSchema(t *testing.T) {
 		if !floatingIP.Created.Equal(time.Date(2017, 8, 16, 17, 29, 14, 0, time.UTC)) {
 			t.Errorf("unexpected created date: %v", floatingIP.Created)
 		}
-
 	})
 
 	t.Run("IPv4", func(t *testing.T) {
@@ -795,7 +794,7 @@ func TestErrorFromSchema(t *testing.T) {
 	t.Run("service_error", func(t *testing.T) {
 		data := []byte(`{
 			"code": "service_error",
-			"message": "An error occured",
+			"message": "An error occurred",
 			"details": {}
 		}`)
 
@@ -808,7 +807,7 @@ func TestErrorFromSchema(t *testing.T) {
 		if err.Code != "service_error" {
 			t.Errorf("unexpected code: %v", err.Code)
 		}
-		if err.Message != "An error occured" {
+		if err.Message != "An error occurred" {
 			t.Errorf("unexpected message: %v", err.Message)
 		}
 	})
@@ -2290,8 +2289,8 @@ func TestServerMetricsFromSchema(t *testing.T) {
 			respFn: func() *schema.ServerGetMetricsResponse {
 				var resp schema.ServerGetMetricsResponse
 
-				resp.Metrics.Start = mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z")
-				resp.Metrics.End = mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z")
+				resp.Metrics.Start = mustParseTime(t, "2017-01-01T00:00:00Z")
+				resp.Metrics.End = mustParseTime(t, "2017-01-01T23:00:00Z")
 				resp.Metrics.TimeSeries = map[string]schema.ServerTimeSeriesVals{
 					"cpu": {
 						Values: []interface{}{"some value"},
@@ -2307,8 +2306,8 @@ func TestServerMetricsFromSchema(t *testing.T) {
 			respFn: func() *schema.ServerGetMetricsResponse {
 				var resp schema.ServerGetMetricsResponse
 
-				resp.Metrics.Start = mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z")
-				resp.Metrics.End = mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z")
+				resp.Metrics.Start = mustParseTime(t, "2017-01-01T00:00:00Z")
+				resp.Metrics.End = mustParseTime(t, "2017-01-01T23:00:00Z")
 				resp.Metrics.TimeSeries = map[string]schema.ServerTimeSeriesVals{
 					"cpu": {
 						Values: []interface{}{
@@ -2326,8 +2325,8 @@ func TestServerMetricsFromSchema(t *testing.T) {
 			respFn: func() *schema.ServerGetMetricsResponse {
 				var resp schema.ServerGetMetricsResponse
 
-				resp.Metrics.Start = mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z")
-				resp.Metrics.End = mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z")
+				resp.Metrics.Start = mustParseTime(t, "2017-01-01T00:00:00Z")
+				resp.Metrics.End = mustParseTime(t, "2017-01-01T23:00:00Z")
 				resp.Metrics.TimeSeries = map[string]schema.ServerTimeSeriesVals{
 					"cpu": {
 						Values: []interface{}{
@@ -2345,8 +2344,8 @@ func TestServerMetricsFromSchema(t *testing.T) {
 			respFn: func() *schema.ServerGetMetricsResponse {
 				var resp schema.ServerGetMetricsResponse
 
-				resp.Metrics.Start = mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z")
-				resp.Metrics.End = mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z")
+				resp.Metrics.Start = mustParseTime(t, "2017-01-01T00:00:00Z")
+				resp.Metrics.End = mustParseTime(t, "2017-01-01T23:00:00Z")
 				resp.Metrics.TimeSeries = map[string]schema.ServerTimeSeriesVals{
 					"cpu": {
 						Values: []interface{}{
@@ -2364,8 +2363,8 @@ func TestServerMetricsFromSchema(t *testing.T) {
 			respFn: func() *schema.ServerGetMetricsResponse {
 				var resp schema.ServerGetMetricsResponse
 
-				resp.Metrics.Start = mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z")
-				resp.Metrics.End = mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z")
+				resp.Metrics.Start = mustParseTime(t, "2017-01-01T00:00:00Z")
+				resp.Metrics.End = mustParseTime(t, "2017-01-01T23:00:00Z")
 				resp.Metrics.TimeSeries = map[string]schema.ServerTimeSeriesVals{
 					"cpu": {
 						Values: []interface{}{
@@ -2402,8 +2401,8 @@ func TestServerMetricsFromSchema(t *testing.T) {
 				return &resp
 			},
 			expected: &ServerMetrics{
-				Start: mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z"),
-				End:   mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z"),
+				Start: mustParseTime(t, "2017-01-01T00:00:00Z"),
+				End:   mustParseTime(t, "2017-01-01T23:00:00Z"),
 				TimeSeries: map[string][]ServerMetricsValue{
 					"cpu": {
 						{Timestamp: 1435781470.622, Value: "42"},
@@ -2446,7 +2445,6 @@ func TestServerMetricsFromSchema(t *testing.T) {
 			}
 		})
 	}
-
 }
 
 func TestLoadBalancerMetricsFromSchema(t *testing.T) {
@@ -2461,8 +2459,8 @@ func TestLoadBalancerMetricsFromSchema(t *testing.T) {
 			respFn: func() *schema.LoadBalancerGetMetricsResponse {
 				var resp schema.LoadBalancerGetMetricsResponse
 
-				resp.Metrics.Start = mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z")
-				resp.Metrics.End = mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z")
+				resp.Metrics.Start = mustParseTime(t, "2017-01-01T00:00:00Z")
+				resp.Metrics.End = mustParseTime(t, "2017-01-01T23:00:00Z")
 				resp.Metrics.TimeSeries = map[string]schema.LoadBalancerTimeSeriesVals{
 					"open_connections": {
 						Values: []interface{}{"some value"},
@@ -2478,8 +2476,8 @@ func TestLoadBalancerMetricsFromSchema(t *testing.T) {
 			respFn: func() *schema.LoadBalancerGetMetricsResponse {
 				var resp schema.LoadBalancerGetMetricsResponse
 
-				resp.Metrics.Start = mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z")
-				resp.Metrics.End = mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z")
+				resp.Metrics.Start = mustParseTime(t, "2017-01-01T00:00:00Z")
+				resp.Metrics.End = mustParseTime(t, "2017-01-01T23:00:00Z")
 				resp.Metrics.TimeSeries = map[string]schema.LoadBalancerTimeSeriesVals{
 					"open_connections": {
 						Values: []interface{}{
@@ -2497,8 +2495,8 @@ func TestLoadBalancerMetricsFromSchema(t *testing.T) {
 			respFn: func() *schema.LoadBalancerGetMetricsResponse {
 				var resp schema.LoadBalancerGetMetricsResponse
 
-				resp.Metrics.Start = mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z")
-				resp.Metrics.End = mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z")
+				resp.Metrics.Start = mustParseTime(t, "2017-01-01T00:00:00Z")
+				resp.Metrics.End = mustParseTime(t, "2017-01-01T23:00:00Z")
 				resp.Metrics.TimeSeries = map[string]schema.LoadBalancerTimeSeriesVals{
 					"open_connections": {
 						Values: []interface{}{
@@ -2516,8 +2514,8 @@ func TestLoadBalancerMetricsFromSchema(t *testing.T) {
 			respFn: func() *schema.LoadBalancerGetMetricsResponse {
 				var resp schema.LoadBalancerGetMetricsResponse
 
-				resp.Metrics.Start = mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z")
-				resp.Metrics.End = mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z")
+				resp.Metrics.Start = mustParseTime(t, "2017-01-01T00:00:00Z")
+				resp.Metrics.End = mustParseTime(t, "2017-01-01T23:00:00Z")
 				resp.Metrics.TimeSeries = map[string]schema.LoadBalancerTimeSeriesVals{
 					"open_connections": {
 						Values: []interface{}{
@@ -2535,8 +2533,8 @@ func TestLoadBalancerMetricsFromSchema(t *testing.T) {
 			respFn: func() *schema.LoadBalancerGetMetricsResponse {
 				var resp schema.LoadBalancerGetMetricsResponse
 
-				resp.Metrics.Start = mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z")
-				resp.Metrics.End = mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z")
+				resp.Metrics.Start = mustParseTime(t, "2017-01-01T00:00:00Z")
+				resp.Metrics.End = mustParseTime(t, "2017-01-01T23:00:00Z")
 				resp.Metrics.TimeSeries = map[string]schema.LoadBalancerTimeSeriesVals{
 					"open_connections": {
 						Values: []interface{}{
@@ -2573,8 +2571,8 @@ func TestLoadBalancerMetricsFromSchema(t *testing.T) {
 				return &resp
 			},
 			expected: &LoadBalancerMetrics{
-				Start: mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z"),
-				End:   mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z"),
+				Start: mustParseTime(t, "2017-01-01T00:00:00Z"),
+				End:   mustParseTime(t, "2017-01-01T23:00:00Z"),
 				TimeSeries: map[string][]LoadBalancerMetricsValue{
 					"open_connections": {
 						{Timestamp: 1435781470.622, Value: "42"},
diff --git a/hcloud/server_test.go b/hcloud/server_test.go
index 8a5a2a4..561c296 100644
--- a/hcloud/server_test.go
+++ b/hcloud/server_test.go
@@ -710,9 +710,7 @@ func TestServersDelete(t *testing.T) {
 	env := newTestEnv()
 	defer env.Teardown()
 
-	env.Mux.HandleFunc("/servers/1", func(w http.ResponseWriter, r *http.Request) {
-		return
-	})
+	env.Mux.HandleFunc("/servers/1", func(w http.ResponseWriter, r *http.Request) {})
 
 	var (
 		ctx    = context.Background()
@@ -763,7 +761,6 @@ func TestServerClientUpdate(t *testing.T) {
 		if updatedServer.ID != 1 {
 			t.Errorf("unexpected server ID: %v", updatedServer.ID)
 		}
-
 	})
 
 	t.Run("update labels", func(t *testing.T) {
@@ -1767,14 +1764,14 @@ func TestServerGetMetrics(t *testing.T) {
 			server: &Server{ID: 1},
 			opts: ServerGetMetricsOpts{
 				Types: []ServerMetricType{ServerMetricCPU},
-				Start: mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z"),
-				End:   mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z"),
+				Start: mustParseTime(t, "2017-01-01T00:00:00Z"),
+				End:   mustParseTime(t, "2017-01-01T23:00:00Z"),
 			},
 			respFn: func() schema.ServerGetMetricsResponse {
 				var resp schema.ServerGetMetricsResponse
 
-				resp.Metrics.Start = mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z")
-				resp.Metrics.End = mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z")
+				resp.Metrics.Start = mustParseTime(t, "2017-01-01T00:00:00Z")
+				resp.Metrics.End = mustParseTime(t, "2017-01-01T23:00:00Z")
 				resp.Metrics.TimeSeries = map[string]schema.ServerTimeSeriesVals{
 					"cpu": {
 						Values: []interface{}{
@@ -1787,8 +1784,8 @@ func TestServerGetMetrics(t *testing.T) {
 				return resp
 			},
 			expected: ServerMetrics{
-				Start: mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z"),
-				End:   mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z"),
+				Start: mustParseTime(t, "2017-01-01T00:00:00Z"),
+				End:   mustParseTime(t, "2017-01-01T23:00:00Z"),
 				TimeSeries: map[string][]ServerMetricsValue{
 					"cpu": {
 						{Timestamp: 1435781470.622, Value: "42"},
@@ -1806,14 +1803,14 @@ func TestServerGetMetrics(t *testing.T) {
 					ServerMetricDisk,
 					ServerMetricNetwork,
 				},
-				Start: mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z"),
-				End:   mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z"),
+				Start: mustParseTime(t, "2017-01-01T00:00:00Z"),
+				End:   mustParseTime(t, "2017-01-01T23:00:00Z"),
 			},
 			respFn: func() schema.ServerGetMetricsResponse {
 				var resp schema.ServerGetMetricsResponse
 
-				resp.Metrics.Start = mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z")
-				resp.Metrics.End = mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z")
+				resp.Metrics.Start = mustParseTime(t, "2017-01-01T00:00:00Z")
+				resp.Metrics.End = mustParseTime(t, "2017-01-01T23:00:00Z")
 				resp.Metrics.TimeSeries = map[string]schema.ServerTimeSeriesVals{
 					"cpu": {
 						Values: []interface{}{
@@ -1850,8 +1847,8 @@ func TestServerGetMetrics(t *testing.T) {
 				return resp
 			},
 			expected: ServerMetrics{
-				Start: mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z"),
-				End:   mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z"),
+				Start: mustParseTime(t, "2017-01-01T00:00:00Z"),
+				End:   mustParseTime(t, "2017-01-01T23:00:00Z"),
 				TimeSeries: map[string][]ServerMetricsValue{
 					"cpu": {
 						{Timestamp: 1435781470.622, Value: "42"},
@@ -1880,8 +1877,8 @@ func TestServerGetMetrics(t *testing.T) {
 			name:   "missing metrics types",
 			server: &Server{ID: 3},
 			opts: ServerGetMetricsOpts{
-				Start: mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z"),
-				End:   mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z"),
+				Start: mustParseTime(t, "2017-01-01T00:00:00Z"),
+				End:   mustParseTime(t, "2017-01-01T23:00:00Z"),
 			},
 			expectedErr: "add query params: no metric types specified",
 		},
@@ -1890,7 +1887,7 @@ func TestServerGetMetrics(t *testing.T) {
 			server: &Server{ID: 4},
 			opts: ServerGetMetricsOpts{
 				Types: []ServerMetricType{ServerMetricCPU},
-				End:   mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z"),
+				End:   mustParseTime(t, "2017-01-01T23:00:00Z"),
 			},
 			expectedErr: "add query params: no start time specified",
 		},
@@ -1899,7 +1896,7 @@ func TestServerGetMetrics(t *testing.T) {
 			server: &Server{ID: 5},
 			opts: ServerGetMetricsOpts{
 				Types: []ServerMetricType{ServerMetricCPU},
-				Start: mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z"),
+				Start: mustParseTime(t, "2017-01-01T00:00:00Z"),
 			},
 			expectedErr: "add query params: no end time specified",
 		},
@@ -1908,8 +1905,8 @@ func TestServerGetMetrics(t *testing.T) {
 			server: &Server{ID: 6},
 			opts: ServerGetMetricsOpts{
 				Types: []ServerMetricType{ServerMetricCPU},
-				Start: mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z"),
-				End:   mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z"),
+				Start: mustParseTime(t, "2017-01-01T00:00:00Z"),
+				End:   mustParseTime(t, "2017-01-01T23:00:00Z"),
 			},
 			respStatus:  http.StatusInternalServerError,
 			expectedErr: "get metrics: hcloud: server responded with status code 500",
@@ -1918,8 +1915,8 @@ func TestServerGetMetrics(t *testing.T) {
 			name: "no server passed",
 			opts: ServerGetMetricsOpts{
 				Types: []ServerMetricType{ServerMetricCPU},
-				Start: mustParseTime(t, time.RFC3339, "2017-01-01T00:00:00Z"),
-				End:   mustParseTime(t, time.RFC3339, "2017-01-01T23:00:00Z"),
+				Start: mustParseTime(t, "2017-01-01T00:00:00Z"),
+				End:   mustParseTime(t, "2017-01-01T23:00:00Z"),
 			},
 			expectedErr: "illegal argument: server is nil",
 		},
@@ -2020,12 +2017,12 @@ func serverMetricsOptsFromURL(t *testing.T, u *url.URL) ServerGetMetricsOpts {
 	return opts
 }
 
-func mustParseTime(t *testing.T, layout, value string) time.Time {
+func mustParseTime(t *testing.T, value string) time.Time {
 	t.Helper()
 
-	ts, err := time.Parse(layout, value)
+	ts, err := time.Parse(time.RFC3339, value)
 	if err != nil {
-		t.Fatalf("parse time: layout %v: value %v", layout, value)
+		t.Fatalf("parse time: layout %v: value %v", time.RFC3339, value)
 	}
 	return ts
 }