Explore ways to reduce size of generated output
- Dominant language
- Java
- Stars
- 255
- Forks
- 83
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 7
Description
### Describe the feature
The files `serialize.go`, `deserialize.go` and `validators.go` contain a lot of generated and uniform code. Using generics will reduce the package size.
The total size of the services is 464 mb:
```sh
du -sh service
464M service
```
The size of these middleware is 182 mb, which is 40% of the total package size.
```sh
find . -type f \( -name "serializers.go" -o -name "deserializers.go" -o -name "validators.go" \) -exec du -ch {} + | grep total$
182M total
```
The output of the [go-size-analizer](https://github.com/Zxilly/go-size-analyzer) for my application:
```sh
gsa ./app
+---------+-----------------------------------------------------------------------------+--------+-----------+
| PERCENT | NAME | SIZE | TYPE |
+---------+-----------------------------------------------------------------------------+--------+-----------+
| 20.63% | github.com/aws/aws-sdk-go-v2 | 57 MB | vendor |
| 13.81% | __gopclntab __DATA_CONST | 38 MB | section |
| 7.59% | __rodata __TEXT | 21 MB | section |
| 7.22% | __rodata __DATA_CONST | 20 MB | section |
| 5.60% | __zdebug_loc __DWARF | 15 MB | section |
| 5.59% | __zdebug_info __DWARF | 15 MB | section |
| 2.98% | k8s.io/api | 8.2 MB | vendor |
| 2.23% | __zdebug_line __DWARF | 6.1 MB | section |
| 1.87% | __zapple_names __DWARF | 5.1 MB | section |
| 1.46% | __zdebug_ranges __DWARF | 4.0 MB | section |
| 1.22% | github.com/alecthomas/chroma | 3.4 MB | vendor |
| 1.02% | github.com/aws/aws-sdk-go | 2.8 MB | vendor |
| 1.00% | github.com/open-policy-agent/opa | 2.8 MB | vendor |
| 0.93% | __data __DATA | 2.6 MB | section |
| 0.85% | __noptrdata __DATA | 2.3 MB | section |
| 0.74% | __zapple_types __DWARF | 2.0 MB | section |
| 0.68% | __zdebug_str __DWARF | 1.9 MB | section |
| 0.64% | | 1.8 MB | generated |
| 0.52% | __zdebug_frame __DWARF | 1.4 MB | section |
| 0.37% | net | 1.0 MB | std |
| 0.36% | google.golang.org/protobuf | 996 kB | vendor |
| 0.35% | github.com/google/gnostic-models | 954 kB | vendor |
```
### Use Case
Reducing the size of Golang binary
### Proposed Solution
_No response_
### Other Information
_No response_
### Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### AWS Go SDK V2 Module Versions Used
-
### Go version used
-
Contributor guide
Research direction
Start by measuring the generated files named in the issue with the provided du and find commands, then inspect serialize.go, deserialize.go, and validators.go. Use gsa ./app to establish the binary-size baseline. Done means the generated middleware and resulting Go binary are smaller while preserving their existing behavior; no concrete implementation or acceptance threshold is specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100