fix: format all Go files with gofmt
All checks were successful
CI / lint (push) Successful in 9m54s
CI / test (push) Successful in 10m19s
CI / build (push) Successful in 9m58s
CI / docker (push) Has been skipped

- Fix alignment in struct fields (sessionProfileResponse, textureInfo, Handler)
- Align struct field values in internal/templates/templates.go, internal/api/api.go
This commit is contained in:
2026-05-30 20:00:54 +03:00
parent 8d1f956a8b
commit 4efcc770ac
8 changed files with 42 additions and 42 deletions

View File

@@ -15,10 +15,10 @@ import (
"strconv"
"strings"
"gitea.mrixs.me/Mrixs/MrixsCraft-server/pkg/utils"
"gitea.mrixs.me/Mrixs/MrixsCraft-server/internal/auth"
"gitea.mrixs.me/Mrixs/MrixsCraft-server/internal/config"
"gitea.mrixs.me/Mrixs/MrixsCraft-server/internal/database"
"gitea.mrixs.me/Mrixs/MrixsCraft-server/pkg/utils"
)
// Handler serves admin endpoints.

View File

@@ -122,8 +122,8 @@ type textureInfo struct {
// Mojang session server profile response (for game client).
type sessionProfileResponse struct {
ID string `json:"id"`
Name string `json:"name"`
ID string `json:"id"`
Name string `json:"name"`
Props []sessionProfileProp `json:"properties"`
}

View File

@@ -52,11 +52,11 @@ type authenticateRequest struct {
}
type authenticateResponse struct {
AccessToken string `json:"accessToken"`
ClientToken string `json:"clientToken"`
AvailableProfile []profile `json:"availableProfiles"`
SelectedProfile *profile `json:"selectedProfile,omitempty"`
User *userProperties `json:"user,omitempty"`
AccessToken string `json:"accessToken"`
ClientToken string `json:"clientToken"`
AvailableProfile []profile `json:"availableProfiles"`
SelectedProfile *profile `json:"selectedProfile,omitempty"`
User *userProperties `json:"user,omitempty"`
}
type profile struct {
@@ -65,7 +65,7 @@ type profile struct {
}
type userProperties struct {
ID string `json:"id"`
ID string `json:"id"`
Properties []property `json:"properties"`
}
@@ -92,8 +92,8 @@ type errorResponse struct {
// Session server types (Mojang-compatible).
type sessionProfileResponse struct {
ID string `json:"id"`
Name string `json:"name"`
ID string `json:"id"`
Name string `json:"name"`
Props []sessionProfileProp `json:"properties"`
}

View File

@@ -20,18 +20,18 @@ import (
// mimeByExtension maps common file extensions to MIME types for CAS serving.
var mimeByExtension = map[string]string{
".jar": "application/java-archive",
".json": "application/json",
".png": "image/png",
".zip": "application/zip",
".toml": "application/toml",
".cfg": "text/plain",
".conf": "text/plain",
".txt": "text/plain",
".log": "text/plain",
".xml": "application/xml",
".yml": "application/x-yaml",
".yaml": "application/x-yaml",
".jar": "application/java-archive",
".json": "application/json",
".png": "image/png",
".zip": "application/zip",
".toml": "application/toml",
".cfg": "text/plain",
".conf": "text/plain",
".txt": "text/plain",
".log": "text/plain",
".xml": "application/xml",
".yml": "application/x-yaml",
".yaml": "application/x-yaml",
".properties": "text/plain",
}

View File

@@ -14,10 +14,10 @@ func TestIsValidHash(t *testing.T) {
{"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2", true},
{"0000000000000000000000000000000000000000", true},
{"ffffffffffffffffffffffffffffffffffffffff", true},
{"A1B2C3D4E5F6A1B2C3D4E5F6A1B2C3D4E5F6A1B2", false}, // uppercase
{"g1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2", false}, // non-hex
{"a1b2c3d4e5f6", false}, // too short
{"", false}, // empty
{"A1B2C3D4E5F6A1B2C3D4E5F6A1B2C3D4E5F6A1B2", false}, // uppercase
{"g1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2", false}, // non-hex
{"a1b2c3d4e5f6", false}, // too short
{"", false}, // empty
{"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3", false}, // too long (41)
}
for _, tt := range tests {

View File

@@ -35,13 +35,13 @@ func Load() (*Config, error) {
}
cfg := &Config{
Port: port,
Port: port,
DatabaseURL: getEnv("DATABASE_URL", ""),
CASDir: getEnv("CAS_DIR", "/var/www/cdn/files"),
SkinsDir: getEnv("SKINS_DIR", "/var/www/cdn/skins"),
JWTSecret: getEnv("JWT_SECRET", ""),
CIsecret: getEnv("CI_SECRET", ""),
BaseURL: getEnv("BASE_URL", "https://minecraft.mrixs.me"),
CASDir: getEnv("CAS_DIR", "/var/www/cdn/files"),
SkinsDir: getEnv("SKINS_DIR", "/var/www/cdn/skins"),
JWTSecret: getEnv("JWT_SECRET", ""),
CIsecret: getEnv("CI_SECRET", ""),
BaseURL: getEnv("BASE_URL", "https://minecraft.mrixs.me"),
}
if cfg.DatabaseURL == "" {

View File

@@ -71,9 +71,9 @@ func (w *statusWriter) WriteHeader(status int) {
type RateLimiter struct {
mu sync.Mutex
clients map[string]*bucket
rate int // tokens per interval
rate int // tokens per interval
interval time.Duration
burst int // max bucket size
burst int // max bucket size
}
type bucket struct {
@@ -85,10 +85,10 @@ type bucket struct {
// with a maximum burst of `burst`.
func NewRateLimiter(rate int, interval time.Duration, burst int) *RateLimiter {
rl := &RateLimiter{
clients: make(map[string]*bucket),
rate: rate,
clients: make(map[string]*bucket),
rate: rate,
interval: interval,
burst: burst,
burst: burst,
}
// Periodically clean up stale entries.
go rl.cleanup()

View File

@@ -19,10 +19,10 @@ type pageData struct {
// Handler serves template-rendered pages.
type Handler struct {
db *database.DB
cfg *config.Config
tmpl *template.Template
loaded bool
db *database.DB
cfg *config.Config
tmpl *template.Template
loaded bool
}
// NewHandler creates a new templates handler and parses on-disk templates.