Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

tidy: convert Fprintf to Fprintln when possible #7174

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/frontend/graphqlbackend/search_pagination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ func TestSearchPagination_sliceSearchResults(t *testing.T) {
}
format := func(r slicedSearchResults) string {
var b bytes.Buffer
fmt.Fprintf(&b, "results:\n")
fmt.Fprintln(&b, "results:")
for i, result := range r.results {
fm, _ := result.ToFileMatch()
fmt.Fprintf(&b, " [%d] %s %s\n", i, fm.Repo.Name, fm.JPath)
}
fmt.Fprintf(&b, "common.repos:\n")
fmt.Fprintln(&b, "common.repos:")
for i, r := range r.common.repos {
fmt.Fprintf(&b, " [%d] %s\n", i, r.Name)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/server/shared/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ func maybeUpgradePostgres(path, newVersion string) (err error) {
hostDataDir, err := hostMountPoint(ctx, cli, id, dataDir)
switch {
case docker.IsErrConnectionFailed(err):
fmt.Fprintf(os.Stderr, "\n Docker socket must be mounted for the automatic upgrade of the internal database to proceed.\n")
fmt.Fprintf(os.Stderr, " 👉 docker run ... -v /var/run/docker.sock:/var/run/docker.sock:ro ...\n\n")
fmt.Fprint(os.Stderr, "\n Docker socket must be mounted for the automatic upgrade of the internal database to proceed.\n")
fmt.Fprint(os.Stderr, " 👉 docker run ... -v /var/run/docker.sock:/var/run/docker.sock:ro ...\n\n")
return errors.New("Docker socket volume mount is missing")
case err != nil:
return errors.Wrap(err, "failed to determine host mount point")
Expand Down
6 changes: 3 additions & 3 deletions internal/debugserver/expvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ import (
// can be mounted on any ServeMux, not just http.DefaultServeMux.
func expvarHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
fmt.Fprintf(w, "{\n")
fmt.Fprintln(w, "{")
first := true
expvar.Do(func(kv expvar.KeyValue) {
if !first {
fmt.Fprintf(w, ",\n")
fmt.Fprintln(w, ",")
}
first = false
fmt.Fprintf(w, "%q: %s", kv.Key, kv.Value)
})
fmt.Fprintf(w, "\n}\n")
fmt.Fprintln(w, "\n}")
}

func gcHandler(w http.ResponseWriter, r *http.Request) {
Expand Down