go fmt'ed

This commit is contained in:
farhan 2020-12-29 20:20:02 +00:00
parent b2974b7501
commit 85e0735fa3
8 changed files with 78 additions and 83 deletions

2
db.go
View File

@ -3,8 +3,8 @@ package main
import (
"context"
"fmt"
"log"
"github.com/jackc/pgx/pgxpool"
"log"
)
func getDbPool() *pgxpool.Pool {

View File

@ -1,6 +1,7 @@
package main
import (
"github.com/jackc/pgx/pgxpool"
"github.com/microcosm-cc/bluemonday"
"log"
"net/http"
@ -8,7 +9,6 @@ import (
"regexp"
"runtime"
"sync"
"github.com/jackc/pgx/pgxpool"
)
// Current instances

View File

@ -14,7 +14,7 @@ import (
var p *bluemonday.Policy
var spaceReg *regexp.Regexp
func GetRunner(endpoint string) (RunningInstance) {
func GetRunner(endpoint string) RunningInstance {
ri_mutex.Lock()
o, exists := runninginstances[endpoint]
if exists == false {
@ -31,15 +31,13 @@ func GetRunner(endpoint string) (RunningInstance) {
return o
}
func UpdateRunner(endpoint string, o RunningInstance) {
ri_mutex.Lock()
runninginstances[endpoint] = o
ri_mutex.Unlock()
}
func GetNodeInfo(endpoint string, o RunningInstance) (RunningInstance) {
func GetNodeInfo(endpoint string, o RunningInstance) RunningInstance {
/* Checking order
* Mastodon/Pleroma
* Um..nothing else yet

View File

@ -26,7 +26,7 @@ func (e *authError) Error() string {
return e.msg
}
func register_client(endpoint string, o *RunningInstance) (error) {
func register_client(endpoint string, o *RunningInstance) error {
requestBodymap, _ := json.Marshal(map[string]string{
"client_name": "Tusky", // Hard-coded in for now...
"scopes": "read write follow push",
@ -91,7 +91,7 @@ func register_client(endpoint string, o *RunningInstance) (error) {
return nil
}
func get_client(endpoint string, o *RunningInstance) (error) {
func get_client(endpoint string, o *RunningInstance) error {
var err error
client_file := "clients/" + endpoint
_, err = os.Stat(client_file)

View File

@ -2,14 +2,14 @@ package main
import (
"context"
"strings"
"log"
"encoding/json"
"time"
"io/ioutil"
"net/http"
"html"
"errors"
"html"
"io/ioutil"
"log"
"net/http"
"strings"
"time"
)
type ImageType struct {
@ -47,7 +47,6 @@ type PostJson struct {
posthash []byte
receivedAt time.Time `json:"created_at"`
Content string `json:"content"`
Conversation string `json:"conversation"`
Published time.Time `json:"published"`
@ -63,7 +62,7 @@ type PostJson struct {
instance string
}
func GetHTTPSession(endpoint string) (RunningInstance) {
func GetHTTPSession(endpoint string) RunningInstance {
ri_mutex.Lock()
o, exist := runninginstances[endpoint]
ri_mutex.Unlock()

View File

@ -70,8 +70,6 @@ func StreamMastodon(endpoint string, o *RunningInstance) {
continue
}
switch strings.TrimSpace(token[0]) {
case "event":
name = strings.TrimSpace(token[1])