Ошибка при отправке сообщения.
2021/08/06 15:44:18 http: panic serving ***.***.***.***:43394: runtime error: invalid memory address or nil pointer dereference
goroutine 214 [running]:
net/http.(*conn).serve.func1(0xc000390320)
/usr/local/go/src/net/http/server.go:1804 +0x153
panic(0x86e400, 0x12032a0)
/usr/local/go/src/runtime/panic.go:971 +0x499
polkovnik/api.apiHandler.MessageSend.func1(0xfb9ea0, 0xc0003360e0, 0xc0001f8600)
/app/api/message.go:43 +0x19a
net/http.HandlerFunc.ServeHTTP(0xc0001a3220, 0xfb9ea0, 0xc0003360e0, 0xc0001f8600)
/usr/local/go/src/net/http/server.go:2049 +0x44
github.com/gorilla/mux.CORSMethodMiddleware.func1.1(0xfb9ea0, 0xc0003360e0, 0xc0001f8600)
/go/pkg/mod/github.com/gorilla/[email protected]/middleware.go:51 +0xf7
net/http.HandlerFunc.ServeHTTP(0xc0001a2900, 0xfb9ea0, 0xc0003360e0, 0xc0001f8600)
/usr/local/go/src/net/http/server.go:2049 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0001a0000, 0xfb9ea0, 0xc0003360e0, 0xc0001f8400)
/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0xd3
net/http.serverHandler.ServeHTTP(0xc00019c000, 0xfb9ea0, 0xc0003360e0, 0xc0001f8400)
/usr/local/go/src/net/http/server.go:2867 +0xa3
net/http.(*conn).serve(0xc000390320, 0xfbab80, 0xc0001c0400)
/usr/local/go/src/net/http/server.go:1932 +0x8cd
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2993 +0x39b
Необходимо валидировать запрос и возвращать корректное сообщение об ошибке.