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
|
// means "default: everyone full" — for restricted categories set it
|
||||||
// explicitly, e.g. {"staff": 3, "trust_level_0": 1}.
|
// explicitly, e.g. {"staff": 3, "trust_level_0": 1}.
|
||||||
type CreateCategoryRequest struct {
|
type CreateCategoryRequest struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Color string `json:"color"` // 6 hex digits, no '#'
|
Color string `json:"color"` // 6 hex digits, no '#'
|
||||||
TextColor string `json:"text_color"` // 6 hex digits, no '#'
|
TextColor string `json:"text_color"` // 6 hex digits, no '#'
|
||||||
Permissions map[string]int `json:"permissions,omitempty"`
|
Permissions map[string]int `json:"permissions,omitempty"`
|
||||||
Position int `json:"position,omitempty"`
|
Position int `json:"position,omitempty"`
|
||||||
ParentCategoryID int `json:"parent_category_id,omitempty"`
|
ParentCategoryID int `json:"parent_category_id,omitempty"`
|
||||||
Description string `json:"description,omitempty"`
|
Description string `json:"description,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListCategories returns the instance's categories (one request; the
|
// 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
|
if req.Name == "denied" { // simulate a non-admin key
|
||||||
writeJSON(w, 403, map[string]any{
|
writeJSON(w, 403, map[string]any{
|
||||||
"errors": []string{"You are not permitted to view the requested resource."},
|
"errors": []string{"You are not permitted to view the requested resource."},
|
||||||
"error_description": "Access denied",
|
"error_description": "Access denied",
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
f.mu.Lock()
|
f.mu.Lock()
|
||||||
cat := Category{
|
cat := Category{
|
||||||
ID: f.nextCat, Name: req.Name,
|
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,
|
Color: req.Color, TextColor: req.TextColor, Position: req.Position,
|
||||||
}
|
}
|
||||||
f.nextCat++
|
f.nextCat++
|
||||||
@@ -158,7 +158,7 @@ func newFake(t *testing.T) *fakeDiscourse {
|
|||||||
case http.MethodPut:
|
case http.MethodPut:
|
||||||
var body struct {
|
var body struct {
|
||||||
Post struct {
|
Post struct {
|
||||||
Raw string `json:"raw"`
|
Raw string `json:"raw"`
|
||||||
EditReason string `json:"edit_reason"`
|
EditReason string `json:"edit_reason"`
|
||||||
} `json:"post"`
|
} `json:"post"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ func main() {
|
|||||||
name, _ := req["name"].(string)
|
name, _ := req["name"].(string)
|
||||||
cat := map[string]any{
|
cat := map[string]any{
|
||||||
"id": s.nextCat, "name": name,
|
"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"),
|
"color": orDefault(req["color"], "3AB54A"), "text_color": orDefault(req["text_color"], "FFFFFF"),
|
||||||
"topic_count": 0,
|
"topic_count": 0,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ type Topic struct {
|
|||||||
CategoryID int `json:"category_id"`
|
CategoryID int `json:"category_id"`
|
||||||
CreatedAt string `json:"created_at"`
|
CreatedAt string `json:"created_at"`
|
||||||
Closed bool `json:"closed"`
|
Closed bool `json:"closed"`
|
||||||
Archived bool `json:"archived"`
|
Archived bool `json:"archived"`
|
||||||
PostStream struct {
|
PostStream struct {
|
||||||
Posts []Post `json:"posts"`
|
Posts []Post `json:"posts"`
|
||||||
} `json:"post_stream"`
|
} `json:"post_stream"`
|
||||||
|
|||||||
Reference in New Issue
Block a user