Skip to content

Commit

Permalink
chore: use fmt.Fprintf instead of fmt.Fprint(fmt.Sprintf(...)) (#621)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>
  • Loading branch information
testwill and andrewsomething committed Aug 23, 2023
1 parent c2b88d2 commit 12ce6ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions projects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestProjects_List(t *testing.T) {
mux.HandleFunc("/v2/projects", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
resp, _ := json.Marshal(expectedProjects)
fmt.Fprint(w, fmt.Sprintf(`{"projects":%s, "meta": {"total": 2}}`, string(resp)))
fmt.Fprintf(w, `{"projects":%s, "meta": {"total": 2}}`, string(resp))
})

projects, resp, err := client.Projects.List(ctx, nil)
Expand Down Expand Up @@ -133,7 +133,7 @@ func TestProjects_GetDefault(t *testing.T) {
mux.HandleFunc("/v2/projects/default", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
resp, _ := json.Marshal(project)
fmt.Fprint(w, fmt.Sprintf(`{"project":%s}`, string(resp)))
fmt.Fprintf(w, `{"project":%s}`, string(resp))
})

resp, _, err := client.Projects.GetDefault(ctx)
Expand All @@ -158,7 +158,7 @@ func TestProjects_GetWithUUID(t *testing.T) {
mux.HandleFunc("/v2/projects/project-1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
resp, _ := json.Marshal(project)
fmt.Fprint(w, fmt.Sprintf(`{"project":%s}`, string(resp)))
fmt.Fprintf(w, `{"project":%s}`, string(resp))
})

resp, _, err := client.Projects.Get(ctx, "project-1")
Expand Down Expand Up @@ -347,7 +347,7 @@ func TestProjects_ListResources(t *testing.T) {
mux.HandleFunc("/v2/projects/project-1/resources", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
resp, _ := json.Marshal(expectedResources)
fmt.Fprint(w, fmt.Sprintf(`{"resources":%s, "meta": {"total": 2}}`, string(resp)))
fmt.Fprintf(w, `{"resources":%s, "meta": {"total": 2}}`, string(resp))
})

resources, resp, err := client.Projects.ListResources(ctx, "project-1", nil)
Expand Down
10 changes: 5 additions & 5 deletions uptime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestUptimeChecks_List(t *testing.T) {
mux.HandleFunc("/v2/uptime/checks", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
resp, _ := json.Marshal(expectedUptimeChecks)
fmt.Fprint(w, fmt.Sprintf(`{"checks":%s, "meta": {"total": 2}}`, string(resp)))
fmt.Fprintf(w, `{"checks":%s, "meta": {"total": 2}}`, string(resp))
})

uptimeChecks, resp, err := client.UptimeChecks.List(ctx, nil)
Expand Down Expand Up @@ -149,7 +149,7 @@ func TestUptimeChecks_GetState(t *testing.T) {
mux.HandleFunc("/v2/uptime/checks/check-1/state", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
resp, _ := json.Marshal(uptimeCheckState)
fmt.Fprint(w, fmt.Sprintf(`{"state":%s}`, string(resp)))
fmt.Fprintf(w, `{"state":%s}`, string(resp))
})

resp, _, err := client.UptimeChecks.GetState(ctx, "check-1")
Expand All @@ -174,7 +174,7 @@ func TestUptimeChecks_GetWithID(t *testing.T) {
mux.HandleFunc("/v2/uptime/checks/check-1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
resp, _ := json.Marshal(uptimeCheck)
fmt.Fprint(w, fmt.Sprintf(`{"check":%s}`, string(resp)))
fmt.Fprintf(w, `{"check":%s}`, string(resp))
})

resp, _, err := client.UptimeChecks.Get(ctx, "check-1")
Expand Down Expand Up @@ -430,7 +430,7 @@ func TestUptimeAlert_GetWithID(t *testing.T) {
mux.HandleFunc("/v2/uptime/checks/check-1/alerts/alert-1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
resp, _ := json.Marshal(alert)
fmt.Fprint(w, fmt.Sprintf(`{"alert":%s}`, string(resp)))
fmt.Fprintf(w, `{"alert":%s}`, string(resp))
})

resp, _, err := client.UptimeChecks.GetAlert(ctx, "check-1", "alert-1")
Expand Down Expand Up @@ -481,7 +481,7 @@ func TestUptimeAlerts_List(t *testing.T) {
mux.HandleFunc("/v2/uptime/checks/check-1/alerts", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
resp, _ := json.Marshal(expectedAlerts)
fmt.Fprint(w, fmt.Sprintf(`{"alerts":%s, "meta": {"total": 2}}`, string(resp)))
fmt.Fprintf(w, `{"alerts":%s, "meta": {"total": 2}}`, string(resp))
})

alerts, resp, err := client.UptimeChecks.ListAlerts(ctx, "check-1", nil)
Expand Down

0 comments on commit 12ce6ef

Please sign in to comment.