Skip to content

Commit 521d68f

Browse files
authored
docs: export Subclients embedded struct (#126)
* docs: export Subclients embedded struct embedding a private struct creates the confusing effect of exporting the public fields of the sub-struct without having them show in documentation. This has some discussion at the language / godoc level: golang/go#6600 This commit exports the subclients field of goobs.Client so the available fields show in documentation. * client: rename subclients to categories
1 parent f13568f commit 521d68f

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type Client struct {
3030
IncomingEvents chan any
3131

3232
client *api.Client
33-
subclients
33+
Categories
3434

3535
conn *websocket.Conn
3636
host string

internal/generate/protocol/generate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func generateRequests(requests []*Request) {
9393
// Write utils for the top-level client
9494
f = NewFile("goobs")
9595
f.HeaderComment("This file has been automatically generated. Don't edit it.")
96-
f.Add(Type().Id("subclients").Struct(topClientFields...))
96+
f.Add(Type().Id("Categories").Struct(topClientFields...))
9797
f.Add(Func().Id("setClients").Params(Id("c").Op("*").Id("Client")).Block(topClientSetters...))
9898
if err := f.Save(fmt.Sprintf("%s/zz_generated.client.go", root)); err != nil {
9999
panic(err)

internal/generate/tests/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func main() {
9292
panic(err)
9393
}
9494

95-
subclients := sortedKeys(structs["subclients"])
95+
subclients := sortedKeys(structs["Categories"])
9696

9797
for _, subclient := range subclients {
9898
category := strings.ToLower(subclient)

zz_generated.client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
ui "github.com/andreykaipov/goobs/api/requests/ui"
1919
)
2020

21-
type subclients struct {
21+
type Categories struct {
2222
Config *config.Client
2323
Filters *filters.Client
2424
General *general.Client

0 commit comments

Comments
 (0)