format go code

This commit is contained in:
yuli
2024-08-06 18:39:40 +03:00
parent 8b2cd99cce
commit 67cfade5e5
17 changed files with 92 additions and 90 deletions

View File

@@ -2,10 +2,10 @@ package main
import ( import (
"fmt" "fmt"
"time"
"strings"
"net/http/httptest" "net/http/httptest"
"strings"
"testing" "testing"
"time"
) )
func helpGetExpStatus(utoken string) (map[string]interface{}, error) { func helpGetExpStatus(utoken string) (map[string]interface{}, error) {

View File

@@ -5,6 +5,7 @@ import (
"net" "net"
"net/http" "net/http"
"strings" "strings"
"github.com/gobuffalo/packr" "github.com/gobuffalo/packr"
"github.com/oschwald/geoip2-golang" "github.com/oschwald/geoip2-golang"
) )
@@ -14,7 +15,6 @@ var (
geoip *geoip2.Reader geoip *geoip2.Reader
) )
func initGeoIP() { func initGeoIP() {
var err error var err error
box := packr.NewBox("../ui") box := packr.NewBox("../ui")

View File

@@ -20,8 +20,10 @@ var userSchema *jsonschema.Schema
// IsAdmin - admin/DPO approval is required // IsAdmin - admin/DPO approval is required
type IsAdmin bool type IsAdmin bool
// IsLocked - variable is locked from changes // IsLocked - variable is locked from changes
type IsLocked bool type IsLocked bool
// IsPreserve variable can never be deleted // IsPreserve variable can never be deleted
type IsPreserve bool type IsPreserve bool

View File

@@ -178,6 +178,7 @@ func (dbobj *SQLiteDB) CloseDB() {
func (dbobj SQLiteDB) BackupDB(w http.ResponseWriter) { func (dbobj SQLiteDB) BackupDB(w http.ResponseWriter) {
/* /*
err := sqlite3dump.DumpDB(dbobj.db, w) err := sqlite3dump.DumpDB(dbobj.db, w)
if err != nil { if err != nil {
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)
log.Printf("error in backup: %s", err) log.Printf("error in backup: %s", err)

View File

@@ -1,13 +1,13 @@
package main package main
import ( import (
"net/http/httptest"
"encoding/json" "encoding/json"
"net/http/httptest"
"strings" "strings"
"testing" "testing"
uuid "github.com/hashicorp/go-uuid"
jsonpatch "github.com/evanphx/json-patch" jsonpatch "github.com/evanphx/json-patch"
uuid "github.com/hashicorp/go-uuid"
) )
func helpCreateUserApp(userTOKEN string, appName string, appJSON string) (map[string]interface{}, error) { func helpCreateUserApp(userTOKEN string, appName string, appJSON string) (map[string]interface{}, error) {

View File

@@ -454,7 +454,6 @@ func (dbobj dbcon) dumpUserPII(email string, conf Config) (string, error) {
return fullJSON, err return fullJSON, err
} }
func (dbobj dbcon) getUserJSONByIndex(indexValue string, indexName string, conf Config) ([]byte, string, error) { func (dbobj dbcon) getUserJSONByIndex(indexValue string, indexName string, conf Config) ([]byte, string, error) {
userBson, err := dbobj.lookupUserRecordByIndex(indexName, indexValue, conf) userBson, err := dbobj.lookupUserRecordByIndex(indexName, indexValue, conf)
if userBson == nil || err != nil { if userBson == nil || err != nil {

View File

@@ -1,14 +1,14 @@
package main package main
import ( import (
"log"
"encoding/json" "encoding/json"
"log"
"net/http/httptest" "net/http/httptest"
"strings" "strings"
"testing" "testing"
uuid "github.com/hashicorp/go-uuid"
jsonpatch "github.com/evanphx/json-patch" jsonpatch "github.com/evanphx/json-patch"
uuid "github.com/hashicorp/go-uuid"
) )
func helpCreateUser(userJSON string) (map[string]interface{}, error) { func helpCreateUser(userJSON string) (map[string]interface{}, error) {

View File

@@ -2,8 +2,8 @@ package main
import ( import (
"fmt" "fmt"
"log"
"io/ioutil" "io/ioutil"
"log"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"strings" "strings"