ran go-fmt on complete sourcecode

This commit is contained in:
Bernhard B
2022-04-01 19:08:07 +02:00
parent d34fcb905e
commit 0b6bd44838
5 changed files with 30 additions and 32 deletions

View File

@@ -3,10 +3,10 @@ package api
import (
"bytes"
"encoding/json"
"errors"
"net/http"
"strconv"
"time"
"errors"
"github.com/gabriel-vasile/mimetype"
"github.com/gin-gonic/gin"
@@ -1351,7 +1351,6 @@ func (a *Api) SearchForNumbers(c *gin.Context) {
c.JSON(200, searchResponse)
}
// @Summary Updates the info associated to a number on the contact list. If the contact doesnt exist yet, it will be added.
// @Tags Contacts
// @Description Updates the info associated to a number on the contact list.

View File

@@ -533,7 +533,7 @@ func (s *SignalClient) getJsonRpc2Client(number string) (*JsonRpc2Client, error)
return nil, errors.New("Number not registered with JSON-RPC")
}
func (s *SignalClient) getJsonRpc2Clients() ([]*JsonRpc2Client) {
func (s *SignalClient) getJsonRpc2Clients() []*JsonRpc2Client {
jsonRpc2Clients := []*JsonRpc2Client{}
for _, client := range s.jsonRpc2Clients {
jsonRpc2Clients = append(jsonRpc2Clients, client)

View File

@@ -101,7 +101,7 @@ func (r *JsonRpc2Client) ReceiveData(number string) {
str, err := connbuf.ReadString('\n')
if err != nil {
elapsed := time.Since(r.lastTimeErrorMessageSent)
if(elapsed) > time.Duration(5*time.Minute) { //avoid spamming the log file and only log the message at max every 5 minutes
if (elapsed) > time.Duration(5*time.Minute) { //avoid spamming the log file and only log the message at max every 5 minutes
log.Error("Couldn't read data for number ", number, ": ", err.Error(), ". Is the number properly registered?")
r.lastTimeErrorMessageSent = time.Now()
}

View File

@@ -1,8 +1,10 @@
package main
import (
"encoding/json"
"fmt"
"github.com/bbernhard/signal-cli-rest-api/utils"
"github.com/gabriel-vasile/mimetype"
log "github.com/sirupsen/logrus"
"io/ioutil"
"os"
@@ -10,8 +12,6 @@ import (
"path/filepath"
"strconv"
"strings"
"github.com/gabriel-vasile/mimetype"
"encoding/json"
)
const supervisorctlConfigTemplate = `
@@ -48,7 +48,6 @@ func isSignalCliLinkedNumberConfigFile(filename string) (bool, error) {
return false, nil
}
func getUsernameFromLinkedNumberConfigFile(filename string) (string, error) {
type LinkedNumberConfigFile struct {
Username string `json:"username"`
@@ -126,7 +125,7 @@ func main() {
uid := utils.GetEnv("SIGNAL_CLI_UID", "1000")
gid := utils.GetEnv("SIGNAL_CLI_GID", "1000")
_, err = exec.Command("chown", uid + ":" + gid, fifoPathname).Output()
_, err = exec.Command("chown", uid+":"+gid, fifoPathname).Output()
if err != nil {
log.Fatal("Couldn't change permissions of fifo with name ", fifoPathname, ": ", err.Error())
}