diff options
-rwxr-xr-x | .githooks/pre-commit | 6 | ||||
-rw-r--r-- | accept.go | 6 | ||||
-rw-r--r-- | cacheDatabase.go | 9 | ||||
-rw-r--r-- | client.go | 5 | ||||
-rw-r--r-- | db/verification.go | 1 | ||||
-rw-r--r-- | outboxGet.go | 12 | ||||
-rw-r--r-- | outboxPost.go | 3 | ||||
-rw-r--r-- | session.go | 4 | ||||
-rw-r--r-- | tripcode.go | 7 |
9 files changed, 35 insertions, 18 deletions
diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 95fbb20..7fda0a3 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -7,6 +7,12 @@ STAGED="$(git diff --cached --name-only -- '*.go')" if [ -n "$STAGED" ]; then for file in $STAGED; do go fmt "$file" + + # run goimports if it's there + if command -v goimports >/dev/null 2>&1; then + goimports -w "$file" + fi + git add "$file" done fi @@ -1,7 +1,9 @@ package main -import "strings" -import "regexp" +import ( + "regexp" + "strings" +) // False positive for application/ld+ld, application/activity+ld, application/json+json var activityRegexp = regexp.MustCompile("application\\/(ld|json|activity)((\\+(ld|json))|$)") diff --git a/cacheDatabase.go b/cacheDatabase.go index d735cfe..b50065f 100644 --- a/cacheDatabase.go +++ b/cacheDatabase.go @@ -1,8 +1,11 @@ package main -import "fmt" -import "database/sql" -import _ "github.com/lib/pq" +import ( + "database/sql" + "fmt" + + _ "github.com/lib/pq" +) func WriteObjectToCache(db *sql.DB, obj ObjectBase) ObjectBase { @@ -3,8 +3,6 @@ package main import ( "database/sql" "fmt" - "github.com/gofiber/fiber/v2" - _ "github.com/lib/pq" "html/template" "log" "net/http" @@ -13,6 +11,9 @@ import ( "strconv" "strings" "time" + + "github.com/gofiber/fiber/v2" + _ "github.com/lib/pq" ) var Key *string = new(string) diff --git a/db/verification.go b/db/verification.go index ea623c7..b976908 100644 --- a/db/verification.go +++ b/db/verification.go @@ -5,7 +5,6 @@ import ( "crypto/rsa" "crypto/sha256" "crypto/x509" - "database/sql" "encoding/base64" "encoding/pem" "errors" diff --git a/outboxGet.go b/outboxGet.go index d2fabc4..10efff0 100644 --- a/outboxGet.go +++ b/outboxGet.go @@ -1,9 +1,13 @@ package main -import "net/http" -import "database/sql" -import _ "github.com/lib/pq" -import "encoding/json" +import ( + "database/sql" + "net/http" + + "encoding/json" + + _ "github.com/lib/pq" +) func GetActorOutbox(w http.ResponseWriter, r *http.Request, db *sql.DB) { actor := GetActorFromPath(db, r.URL.Path, "/") diff --git a/outboxPost.go b/outboxPost.go index 2fc6b08..ee1e9e5 100644 --- a/outboxPost.go +++ b/outboxPost.go @@ -4,7 +4,6 @@ import ( "database/sql" "encoding/json" "fmt" - _ "github.com/lib/pq" "io/ioutil" "mime/multipart" "net/http" @@ -12,6 +11,8 @@ import ( "os/exec" "regexp" "strings" + + _ "github.com/lib/pq" ) func ParseOutboxRequest(w http.ResponseWriter, r *http.Request, db *sql.DB) { @@ -3,11 +3,11 @@ package main import ( "bufio" "fmt" - "github.com/gofiber/fiber/v2" - "github.com/gomodule/redigo/redis" "net/http" "os" "strings" + + "github.com/gomodule/redigo/redis" ) var cache redis.Conn diff --git a/tripcode.go b/tripcode.go index b567bf0..9947db6 100644 --- a/tripcode.go +++ b/tripcode.go @@ -3,13 +3,14 @@ package main import ( "bytes" "database/sql" + "net/http" + "regexp" + "strings" + _ "github.com/lib/pq" "github.com/simia-tech/crypt" "golang.org/x/text/encoding/japanese" "golang.org/x/text/transform" - "net/http" - "regexp" - "strings" ) const SaltTable = "" + |