Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add bundle #47

Merged
merged 10 commits into from
Dec 4, 2022
Merged

add bundle #47

merged 10 commits into from
Dec 4, 2022

Conversation

switchupcb
Copy link
Owner

@switchupcb switchupcb commented Dec 3, 2022

This pull request adds the disgo.go bundle with fieldalignment.

Compiled Binary Size

Does adding a copy of wrapper (the bundle) make the binary larger? No. To start, the number is lower than stated because I forgot to import the cost of importing fmt. In addition, the compiler will ignore certain packages that remain unused. Such that importing fmt and disgo totals 6.5 MB. Importing disgo and wrapper only increases the amount slightly more. So either the method to achieve this measurement is extremely wrong, or disgo only adds 4.7 MB (rounded up to 5 MB).

The command example is only 10.8 MB despite importing a bit more than fmt and disgo.

switchupcb added 4 commits December 2, 2022 23:44
"github.com/switchupcb/disgo"
go get -u
@switchupcb
Copy link
Owner Author

switchupcb commented Dec 3, 2022

Moved to main thread.

@switchupcb
Copy link
Owner Author

switchupcb commented Dec 3, 2022

The main concern with using fieldalignment is that it removes comments. This occurs presumably due to golang/go#20744 which prevents the tool from maintaining comment positions. One way to solve this is to add an additional step to the bundle (disgo) tool to replace fieldaligned structs with removed comments with field aligned structs that maintain comments. The following output shows all the structs that fieldalignment fixes. However, the actual number to replace isn't as much since many of these structs come from Dasgo which don't maintain field comments.

>fieldalignment -fix disgo.go
disgo.go:92:20: struct with 96 pointer bytes could be 88
disgo.go:135:14: struct with 48 pointer bytes could be 24
disgo.go:203:14: struct with 40 pointer bytes could be 32
disgo.go:312:28: struct with 32 pointer bytes could be 24
disgo.go:463:26: struct with 32 pointer bytes could be 24
disgo.go:928:12: struct with 88 pointer bytes could be 64
disgo.go:978:36: struct with 128 pointer bytes could be 112
disgo.go:1047:26: struct with 72 pointer bytes could be 64
disgo.go:1057:24: struct with 40 pointer bytes could be 32
disgo.go:1086:18: struct with 24 pointer bytes could be 16
disgo.go:1093:21: struct with 24 pointer bytes could be 16
disgo.go:1120:21: struct with 24 pointer bytes could be 16
disgo.go:1127:24: struct with 24 pointer bytes could be 16
disgo.go:1140:24: struct with 112 pointer bytes could be 80
disgo.go:1152:22: struct with 24 pointer bytes could be 16
disgo.go:1159:22: struct with 24 pointer bytes could be 16
disgo.go:1221:24: struct with 40 pointer bytes could be 32
disgo.go:1235:19: struct with 112 pointer bytes could be 88
disgo.go:1272:20: struct with 40 pointer bytes could be 32
disgo.go:1280:24: struct with 48 pointer bytes could be 32
disgo.go:1288:25: struct with 72 pointer bytes could be 64
disgo.go:1299:28: struct with 64 pointer bytes could be 56
disgo.go:1309:31: struct with 40 pointer bytes could be 32
disgo.go:1317:33: struct with 48 pointer bytes could be 40
disgo.go:1326:21: struct with 72 pointer bytes could be 56
disgo.go:1354:18: struct with 72 pointer bytes could be 64
disgo.go:1376:24: struct with 40 pointer bytes could be 32
disgo.go:1391:21: struct with 48 pointer bytes could be 24
disgo.go:1400:28: struct with 32 pointer bytes could be 16
disgo.go:1545:15: struct with 96 pointer bytes could be 88
disgo.go:1579:26: struct with 72 pointer bytes could be 48
disgo.go:1590:30: struct with 24 pointer bytes could be 16
disgo.go:1599:28: struct with 40 pointer bytes could be 32
disgo.go:1632:22: struct with 64 pointer bytes could be 24
disgo.go:1765:37: struct with 88 pointer bytes could be 72
disgo.go:1786:35: struct with 88 pointer bytes could be 72
disgo.go:1814:34: struct with 24 pointer bytes could be 16
disgo.go:1822:36: struct with 96 pointer bytes could be 80
disgo.go:1844:34: struct with 96 pointer bytes could be 80
disgo.go:1905:32: struct with 40 pointer bytes could be 32
disgo.go:1914:37: struct with 24 pointer bytes could be 16
disgo.go:1922:38: struct with 104 pointer bytes could be 88
disgo.go:1944:28: struct with 192 pointer bytes could be 176
disgo.go:1964:25: struct with 40 pointer bytes could be 32
disgo.go:1973:26: struct with 120 pointer bytes could be 104
disgo.go:1997:23: struct with 48 pointer bytes could be 40
disgo.go:2025:31: struct with 112 pointer bytes could be 104
disgo.go:2078:27: struct with 32 pointer bytes could be 24
disgo.go:2087:25: struct with 176 pointer bytes could be 160
disgo.go:2134:25: struct with 48 pointer bytes could be 40
disgo.go:2153:20: struct with 184 pointer bytes could be 168
disgo.go:2207:19: struct with 64 pointer bytes could be 56
disgo.go:2235:18: struct with 104 pointer bytes could be 88
disgo.go:2266:29: struct with 48 pointer bytes could be 40
disgo.go:2284:26: struct with 64 pointer bytes could be 56
disgo.go:2344:26: struct with 56 pointer bytes could be 48
disgo.go:2362:29: struct with 64 pointer bytes could be 56
disgo.go:2373:32: struct with 64 pointer bytes could be 56
disgo.go:2396:31: struct with 144 pointer bytes could be 128
disgo.go:2455:32: struct with 32 pointer bytes could be 24
disgo.go:2464:33: struct with 32 pointer bytes could be 24
disgo.go:2473:39: struct with 32 pointer bytes could be 24
disgo.go:2507:23: struct with 48 pointer bytes could be 40
disgo.go:2525:18: struct with 136 pointer bytes could be 120
disgo.go:2543:15: struct with 24 pointer bytes could be 16
disgo.go:2558:18: struct with 192 pointer bytes could be 168
disgo.go:2598:25: struct with 152 pointer bytes could be 144
disgo.go:2628:43: struct with 40 pointer bytes could be 32
disgo.go:2653:23: struct with 32 pointer bytes could be 24
disgo.go:2662:25: struct with 40 pointer bytes could be 32
disgo.go:2671:21: struct with 96 pointer bytes could be 80
disgo.go:2684:24: struct with 80 pointer bytes could be 72
disgo.go:2698:26: struct with 24 pointer bytes could be 16
disgo.go:2732:19: struct with 40 pointer bytes could be 32
disgo.go:2750:21: struct with 40 pointer bytes could be 32
disgo.go:2774:22: struct with 72 pointer bytes could be 64
disgo.go:2795:40: struct with 24 pointer bytes could be 16
disgo.go:2803:22: struct with 88 pointer bytes could be 80
disgo.go:2834:25: struct with 32 pointer bytes could be 24
disgo.go:2843:22: struct with 40 pointer bytes could be 24
disgo.go:2903:24: struct with 24 pointer bytes could be 16
disgo.go:2912:26: struct with 24 pointer bytes could be 16
disgo.go:2940:31: struct with 40 pointer bytes could be 32
disgo.go:2950:34: struct with 40 pointer bytes could be 32
disgo.go:2960:27: struct with 56 pointer bytes could be 48
disgo.go:2970:34: struct with 24 pointer bytes could be 16
disgo.go:2978:32: struct with 112 pointer bytes could be 96
disgo.go:2994:29: struct with 40 pointer bytes could be 32
disgo.go:3003:32: struct with 112 pointer bytes could be 104
disgo.go:3029:34: struct with 64 pointer bytes could be 56
disgo.go:3048:35: struct with 40 pointer bytes could be 32
disgo.go:3064:26: struct with 40 pointer bytes could be 32
disgo.go:3081:26: struct with 48 pointer bytes could be 40
disgo.go:3099:16: struct with 40 pointer bytes could be 32
disgo.go:3116:26: struct with 48 pointer bytes could be 40
disgo.go:3133:26: struct with 32 pointer bytes could be 24
disgo.go:3187:25: struct with 56 pointer bytes could be 48
disgo.go:3256:20: struct with 32 pointer bytes could be 16
disgo.go:3274:20: struct with 40 pointer bytes could be 32
disgo.go:3312:20: struct with 40 pointer bytes could be 32
disgo.go:3322:29: struct with 48 pointer bytes could be 40
disgo.go:3347:21: struct with 200 pointer bytes could be 184
disgo.go:3368:36: struct with 48 pointer bytes could be 40
disgo.go:3378:37: struct with 48 pointer bytes could be 40
disgo.go:3388:24: struct with 56 pointer bytes could be 48
disgo.go:3398:25: struct with 120 pointer bytes could be 104
disgo.go:3414:27: struct with 56 pointer bytes could be 48
disgo.go:3485:14: struct with 48 pointer bytes could be 40
disgo.go:3495:25: struct with 144 pointer bytes could be 136
disgo.go:3520:31: struct with 176 pointer bytes could be 152
disgo.go:3612:13: struct with 48 pointer bytes could be 40
disgo.go:3637:17: struct with 104 pointer bytes could be 80
disgo.go:3650:23: struct with 56 pointer bytes could be 48
disgo.go:3660:16: struct with 72 pointer bytes could be 56
disgo.go:3680:18: struct with 144 pointer bytes could be 120
disgo.go:3715:29: struct with 88 pointer bytes could be 64
disgo.go:3727:27: struct with 32 pointer bytes could be 24
disgo.go:3753:46: struct with 64 pointer bytes could be 40
disgo.go:3763:25: struct with 56 pointer bytes could be 40
disgo.go:3773:26: struct with 24 pointer bytes could be 16
disgo.go:3824:18: struct with 216 pointer bytes could be 192
disgo.go:3863:20: struct with 32 pointer bytes could be 24
disgo.go:3882:20: struct with 80 pointer bytes could be 56
disgo.go:3969:21: struct with 56 pointer bytes could be 48
disgo.go:3980:25: struct of size 256 could be 248
disgo.go:4031:27: struct with 16 pointer bytes could be 8
disgo.go:4053:14: struct with 336 pointer bytes could be 320
disgo.go:4129:14: struct of size 432 could be 416
disgo.go:4198:22: struct with 16 pointer bytes could be 8
disgo.go:4244:15: struct with 24 pointer bytes could be 8
disgo.go:4252:26: struct with 48 pointer bytes could be 40
disgo.go:4261:21: struct of size 64 could be 56
disgo.go:4288:15: struct with 64 pointer bytes could be 48
disgo.go:4316:21: struct with 40 pointer bytes could be 32
disgo.go:4334:17: struct with 40 pointer bytes could be 32
disgo.go:4350:18: struct with 40 pointer bytes could be 32
disgo.go:4359:18: struct with 32 pointer bytes could be 24
disgo.go:4367:17: struct with 40 pointer bytes could be 32
disgo.go:4387:17: struct with 112 pointer bytes could be 96
disgo.go:4428:12: struct with 80 pointer bytes could be 64
disgo.go:4441:12: struct of size 416 could be 384
disgo.go:4588:19: struct with 136 pointer bytes could be 120
disgo.go:4604:26: struct with 16 pointer bytes could be 8
disgo.go:4622:18: struct with 112 pointer bytes could be 88
disgo.go:4673:29: struct with 64 pointer bytes could be 56
disgo.go:4697:27: struct with 40 pointer bytes could be 32
disgo.go:4706:26: struct with 152 pointer bytes could be 136
disgo.go:4756:30: struct with 32 pointer bytes could be 24
disgo.go:4764:20: struct with 152 pointer bytes could be 136
disgo.go:4780:13: struct with 96 pointer bytes could be 88
disgo.go:4803:21: struct with 56 pointer bytes could be 24
disgo.go:4813:20: struct with 80 pointer bytes could be 64
disgo.go:4831:14: struct with 112 pointer bytes could be 96
disgo.go:4871:18: struct with 104 pointer bytes could be 88
disgo.go:4883:11: struct with 144 pointer bytes could be 136
disgo.go:4955:17: struct of size 88 could be 80
disgo.go:4983:14: struct with 104 pointer bytes could be 88
disgo.go:5060:11: struct of size 104 could be 96
disgo.go:5084:11: struct with 80 pointer bytes could be 72
disgo.go:5095:17: struct with 56 pointer bytes could be 32
disgo.go:5119:15: struct with 128 pointer bytes could be 104
disgo.go:5157:20: struct with 32 pointer bytes could be 24
disgo.go:5291:46: struct with 48 pointer bytes could be 32
disgo.go:5306:28: struct with 24 pointer bytes could be 16
disgo.go:5325:26: struct with 64 pointer bytes could be 56
disgo.go:5335:18: struct with 64 pointer bytes could be 56
disgo.go:5345:43: struct with 48 pointer bytes could be 40
disgo.go:5354:27: struct with 80 pointer bytes could be 64
disgo.go:5365:50: struct with 72 pointer bytes could be 64
disgo.go:6532:19: struct with 96 pointer bytes could be 88
disgo.go:6595:24: struct with 48 pointer bytes could be 40
disgo.go:6645:19: struct with 32 pointer bytes could be 24
disgo.go:6663:22: struct with 48 pointer bytes could be 40
disgo.go:10088:20: struct with 48 pointer bytes could be 32
disgo.go:10526:16: struct with 48 pointer bytes could be 32
disgo.go:10971:13: struct with 72 pointer bytes could be 56
disgo.go:16959:14: struct with 80 pointer bytes could be 64
disgo.go:17526:16: struct with 24 pointer bytes could be 16
disgo.go:17799:14: struct with 64 pointer bytes could be 40

@switchupcb
Copy link
Owner Author

The following structs have their field comments removed.

Authorization
Request
Gateway

ErrorRequest
ErrorEventHandler
ErrorSession
ErrorDisconnect

BotAuthParams

RateLimit
Bucket
Session

heartbeat (unexported)
manager (unexported)

GetGuildWidgetImage
GetGuildAuditLog
Message
Guild

manual fieldaligns
bundle fix
add tools
refactor copygen location
@switchupcb
Copy link
Owner Author

The following structs have their field comments removed.

Gateway
Session

heartbeat (unexported)
manager (unexported)

GetGuildWidgetImage
GetGuildAuditLog
Message
Guild

exit code 3 may indicate that the tool was unable to align everything
switchupcb added 2 commits December 4, 2022 02:25
@switchupcb
Copy link
Owner Author

@switchupcb switchupcb temporarily deployed to testing December 4, 2022 08:57 Inactive
@switchupcb switchupcb merged commit 6ad3efa into v10 Dec 4, 2022
@switchupcb switchupcb deleted the bundle branch December 5, 2022 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant