~yerinalexey/gtranslate

54be24d1a5d0e714ac28dbe42cbfcf33217fdd85 — Alexey Yerin 7 months ago 3f6bdee
api: use fmt.Fprint/Fprintln

Honestly I didn't know it existed at the time of writing gtranslate :)
2 files changed, 3 insertions(+), 2 deletions(-)

M api.go
M utils.go
M api.go => api.go +2 -1
@@ 1,6 1,7 @@
package main

import (
	"fmt"
	"net/http"
)



@@ 28,6 29,6 @@ func CreateApiHandler(settings *TranslateSettings) func(w http.ResponseWriter, r
			return
		}

		w.Write([]byte(translation))
		fmt.Fprint(w, translation)
	}
}

M utils.go => utils.go +1 -1
@@ 7,5 7,5 @@ import (

func writeError(w http.ResponseWriter, status int, err interface{}) {
	w.WriteHeader(status)
	w.Write([]byte(fmt.Sprintln(err)))
	fmt.Fprintln(w, err)
}