tianon / gosu

Simple Go-based setuid+setgid+setgroups+exec
Apache License 2.0
4.68k stars 312 forks source link

Remove use of text/template #138

Closed AlexanderYastrebov closed 5 months ago

AlexanderYastrebov commented 5 months ago

Use of text/template inhibits dead code elimination, see https://github.com/golang/go/issues/62024

Building with go1.22.1 via go build -v -trimpath -ldflags '-d -w' results in binary size reduction from 2704725 to 1652718 bytes (-39%).

AlexanderYastrebov commented 5 months ago

Building with outdated go1.18.2 results in binary size reduction from 2351385 to 1495254 (-36%).

AlexanderYastrebov commented 5 months ago

we can probably get more small gains from applying this same simplification logic to other parts of the code 😀

That's a tough call - the code is pretty slick :smile: Thank you for the utility.