style: gofmt struct-tag alignment across v0 files
v0 landed with a few misaligned struct tags and fields; gofmt -l flagged categories.go, topics.go, discourse_test.go and the smoke fake. Alignment only, no behavior change, so the tree passes the gofmt gate cleanly.
This commit is contained in:
+7
-7
@@ -28,13 +28,13 @@ type Category struct {
|
||||
// means "default: everyone full" — for restricted categories set it
|
||||
// explicitly, e.g. {"staff": 3, "trust_level_0": 1}.
|
||||
type CreateCategoryRequest struct {
|
||||
Name string `json:"name"`
|
||||
Color string `json:"color"` // 6 hex digits, no '#'
|
||||
TextColor string `json:"text_color"` // 6 hex digits, no '#'
|
||||
Permissions map[string]int `json:"permissions,omitempty"`
|
||||
Position int `json:"position,omitempty"`
|
||||
ParentCategoryID int `json:"parent_category_id,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Color string `json:"color"` // 6 hex digits, no '#'
|
||||
TextColor string `json:"text_color"` // 6 hex digits, no '#'
|
||||
Permissions map[string]int `json:"permissions,omitempty"`
|
||||
Position int `json:"position,omitempty"`
|
||||
ParentCategoryID int `json:"parent_category_id,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// ListCategories returns the instance's categories (one request; the
|
||||
|
||||
+4
-4
@@ -82,15 +82,15 @@ func newFake(t *testing.T) *fakeDiscourse {
|
||||
}
|
||||
if req.Name == "denied" { // simulate a non-admin key
|
||||
writeJSON(w, 403, map[string]any{
|
||||
"errors": []string{"You are not permitted to view the requested resource."},
|
||||
"error_description": "Access denied",
|
||||
"errors": []string{"You are not permitted to view the requested resource."},
|
||||
"error_description": "Access denied",
|
||||
})
|
||||
return
|
||||
}
|
||||
f.mu.Lock()
|
||||
cat := Category{
|
||||
ID: f.nextCat, Name: req.Name,
|
||||
Slug: strings.ToLower(strings.ReplaceAll(req.Name, " ", "-")),
|
||||
Slug: strings.ToLower(strings.ReplaceAll(req.Name, " ", "-")),
|
||||
Color: req.Color, TextColor: req.TextColor, Position: req.Position,
|
||||
}
|
||||
f.nextCat++
|
||||
@@ -158,7 +158,7 @@ func newFake(t *testing.T) *fakeDiscourse {
|
||||
case http.MethodPut:
|
||||
var body struct {
|
||||
Post struct {
|
||||
Raw string `json:"raw"`
|
||||
Raw string `json:"raw"`
|
||||
EditReason string `json:"edit_reason"`
|
||||
} `json:"post"`
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ func main() {
|
||||
name, _ := req["name"].(string)
|
||||
cat := map[string]any{
|
||||
"id": s.nextCat, "name": name,
|
||||
"slug": strings.ToLower(strings.ReplaceAll(name, " ", "-")),
|
||||
"slug": strings.ToLower(strings.ReplaceAll(name, " ", "-")),
|
||||
"color": orDefault(req["color"], "3AB54A"), "text_color": orDefault(req["text_color"], "FFFFFF"),
|
||||
"topic_count": 0,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user