mirror of
https://github.com/elyby/chrly.git
synced 2025-05-31 14:11:51 +05:30
Resolve golangcibot issues
This commit is contained in:
10
http/http.go
10
http/http.go
@@ -3,9 +3,6 @@ package http
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func NotFound(response http.ResponseWriter, _ *http.Request) {
|
||||
@@ -19,13 +16,6 @@ func NotFound(response http.ResponseWriter, _ *http.Request) {
|
||||
_, _ = response.Write(data)
|
||||
}
|
||||
|
||||
func waitForSignal() os.Signal {
|
||||
ch := make(chan os.Signal)
|
||||
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
|
||||
|
||||
return <-ch
|
||||
}
|
||||
|
||||
func apiBadRequest(resp http.ResponseWriter, errorsPerField map[string][]string) {
|
||||
resp.WriteHeader(http.StatusBadRequest)
|
||||
resp.Header().Set("Content-Type", "application/json")
|
||||
|
@@ -111,12 +111,7 @@ func (ctx *Skinsystem) Run() error {
|
||||
Handler: ctx.CreateHandler(),
|
||||
}
|
||||
|
||||
go server.Serve(listener)
|
||||
|
||||
s := waitForSignal()
|
||||
ctx.Logger.Info(fmt.Sprintf("Got signal: %v, exiting.", s))
|
||||
|
||||
return nil
|
||||
return server.Serve(listener)
|
||||
}
|
||||
|
||||
func (ctx *Skinsystem) CreateHandler() *mux.Router {
|
||||
@@ -274,7 +269,7 @@ func (ctx *Skinsystem) Textures(response http.ResponseWriter, request *http.Requ
|
||||
|
||||
responseData, _ := json.Marshal(textures)
|
||||
response.Header().Set("Content-Type", "application/json")
|
||||
response.Write(responseData)
|
||||
_, _ = response.Write(responseData)
|
||||
}
|
||||
|
||||
func (ctx *Skinsystem) SignedTextures(response http.ResponseWriter, request *http.Request) {
|
||||
@@ -315,7 +310,7 @@ func (ctx *Skinsystem) SignedTextures(response http.ResponseWriter, request *htt
|
||||
|
||||
responseJson, _ := json.Marshal(responseData)
|
||||
response.Header().Set("Content-Type", "application/json")
|
||||
response.Write(responseJson)
|
||||
_, _ = response.Write(responseJson)
|
||||
}
|
||||
|
||||
func (ctx *Skinsystem) PostSkin(resp http.ResponseWriter, req *http.Request) {
|
||||
|
@@ -40,13 +40,7 @@ func (ctx *UUIDsWorker) Run() error {
|
||||
Handler: ctx.CreateHandler(),
|
||||
}
|
||||
|
||||
// noinspection GoUnhandledErrorResult
|
||||
go server.Serve(listener)
|
||||
|
||||
s := waitForSignal()
|
||||
ctx.Logger.Info(fmt.Sprintf("Got signal: %v, exiting.", s))
|
||||
|
||||
return nil
|
||||
return server.Serve(listener)
|
||||
}
|
||||
|
||||
func (ctx *UUIDsWorker) CreateHandler() http.Handler {
|
||||
|
Reference in New Issue
Block a user