From fbf9732a7a7a599fdc35b7e9e2072d32d2ea9d33 Mon Sep 17 00:00:00 2001 From: KushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com> Date: Sat, 30 Oct 2021 00:31:39 -0300 Subject: goimports --- .githooks/pre-commit | 6 ++++++ accept.go | 6 ++++-- cacheDatabase.go | 9 ++++++--- client.go | 5 +++-- db/verification.go | 1 - outboxGet.go | 12 ++++++++---- outboxPost.go | 3 ++- session.go | 4 ++-- 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 diff --git a/accept.go b/accept.go index b357cc4..6a15857 100644 --- a/accept.go +++ b/accept.go @@ -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 { diff --git a/client.go b/client.go index 704700e..b4323d3 100644 --- a/client.go +++ b/client.go @@ -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) { diff --git a/session.go b/session.go index fd29a01..46c58ea 100644 --- a/session.go +++ b/session.go @@ -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 = "" + -- cgit v1.2.3