Fix lint
This commit is contained in:
parent
4d35153aff
commit
d4b3d57a89
6 changed files with 32 additions and 11 deletions
2
Makefile
2
Makefile
|
@ -17,3 +17,5 @@ generate:
|
|||
sqlc generate -f sql/sqlc.yaml
|
||||
protoc -I=pkg/pb/ --go_out=pkg/ pkg/pb/stillbox.proto
|
||||
|
||||
lint:
|
||||
golangci-lint run
|
||||
|
|
|
@ -61,7 +61,10 @@ func (p *Player) playMP3(audio []byte) error {
|
|||
}
|
||||
|
||||
var player = p.ctx.NewPlayer()
|
||||
player.Write(data)
|
||||
_, err = player.Write(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
<-time.After(time.Second)
|
||||
|
||||
|
|
|
@ -50,6 +50,9 @@ func AddUser(ctx context.Context, username, email string, isAdmin bool) error {
|
|||
}
|
||||
|
||||
hashpw, err := bcrypt.GenerateFromPassword([]byte(pw), bcrypt.DefaultCost)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = db.CreateUser(context.Background(), database.CreateUserParams{
|
||||
Username: username,
|
||||
|
@ -97,6 +100,9 @@ func Passwd(ctx context.Context, username string) error {
|
|||
}
|
||||
|
||||
hashpw, err := bcrypt.GenerateFromPassword([]byte(pw), bcrypt.DefaultCost)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return db.UpdatePassword(context.Background(), username, string(hashpw))
|
||||
}
|
||||
|
|
|
@ -94,10 +94,12 @@ func (conn *wsConn) readPump(ctx context.Context, reg Registry, c Client) {
|
|||
}()
|
||||
|
||||
conn.SetReadLimit(maxMessageSize)
|
||||
conn.SetReadDeadline(time.Now().Add(pongWait))
|
||||
err := conn.SetReadDeadline(time.Now().Add(pongWait))
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("SetReadDeadline")
|
||||
}
|
||||
conn.SetPongHandler(func(string) error {
|
||||
conn.SetReadDeadline(time.Now().Add(pongWait))
|
||||
return nil
|
||||
return conn.SetReadDeadline(time.Now().Add(pongWait))
|
||||
})
|
||||
for {
|
||||
_, message, err := conn.ReadMessage()
|
||||
|
@ -125,10 +127,16 @@ func (conn *wsConn) writePump() {
|
|||
for {
|
||||
select {
|
||||
case msg, ok := <-conn.out:
|
||||
conn.SetWriteDeadline(time.Now().Add(writeWait))
|
||||
err := conn.SetWriteDeadline(time.Now().Add(writeWait))
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("SetWriteDeadline")
|
||||
}
|
||||
if !ok {
|
||||
// nexus closed us
|
||||
conn.WriteMessage(websocket.CloseMessage, []byte{})
|
||||
err := conn.WriteMessage(websocket.CloseMessage, []byte{})
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("writing close message")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -145,7 +153,10 @@ func (conn *wsConn) writePump() {
|
|||
return
|
||||
}
|
||||
case <-pingTicker.C:
|
||||
conn.SetWriteDeadline(time.Now().Add(writeWait))
|
||||
err := conn.SetWriteDeadline(time.Now().Add(writeWait))
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("SetWriteDeadline")
|
||||
}
|
||||
if err := conn.WriteMessage(websocket.PingMessage, nil); err != nil {
|
||||
log.Debug().Err(err).Msg("x ping failed")
|
||||
return
|
||||
|
@ -162,7 +173,7 @@ func (conn *wsConn) writeMessage(w io.WriteCloser, msg *pb.Message) {
|
|||
return
|
||||
}
|
||||
|
||||
w.Write(packed)
|
||||
_, _ = w.Write(packed)
|
||||
}
|
||||
|
||||
packWrite(msg)
|
||||
|
|
|
@ -61,6 +61,5 @@ func (s *Server) Go() error {
|
|||
|
||||
go s.nex.Go(ctx)
|
||||
|
||||
http.ListenAndServe(s.conf.Listen, s.r)
|
||||
return nil
|
||||
return http.ListenAndServe(s.conf.Listen, s.r)
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ func (h *RdioHTTP) routeCallUpload(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
log.Info().Int("system", cur.System).Int("tgid", cur.Talkgroup).Msg("ingested")
|
||||
|
||||
w.Write([]byte("Call imported successfully."))
|
||||
_, _ = w.Write([]byte("Call imported successfully."))
|
||||
}
|
||||
|
||||
func (car *callUploadRequest) fill(r *http.Request) error {
|
||||
|
|
Loading…
Reference in a new issue