Hello,
This library is currently using github.com/go-ozzo/ozzo-validation, but github.com/go-ozzo/ozzo-validation is using text/template to generate some error messages.
text/template is defeating the Dead Code Elimination (DCE) optimization (this is a known problem).
Simple example, with only one file:
package main
import (
"fmt"
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v13/pkg/dns"
)
func main() {
request := dns.CreateRecordRequest{}
fmt.Println(request.Validate())
}
Compilation with github.com/go-ozzo/ozzo-validation:
$ go build -o sandbox .
$ ll sandbox
Permissions Size User Group Date Modified Name
.rwxr-xr-x 12M ldez ldez 21 avril 02:52 sandbox
$ go build -o sandbox -ldflags '-w -s' .
$ ll sandbox
Permissions Size User Group Date Modified Name
.rwxr-xr-x 8,4M ldez ldez 21 avril 03:00 sandbox
Compilation with an altered version of github.com/go-ozzo/ozzo-validation without text/template:
$ go build -o sandbox .
$ ll sandbox
Permissions Size User Group Date Modified Name
.rwxr-xr-x 7,9M ldez ldez 21 avril 02:54 sandbox
$ go build -o sandbox -ldflags '-w -s' .
$ ll sandbox
Permissions Size User Group Date Modified Name
.rwxr-xr-x 5,5M ldez ldez 21 avril 03:00 sandbox
As you can see, the size of the binary is decreased by ~40% when not using text/template.
It could be great if you can remove github.com/go-ozzo/ozzo-validation or use a fork without text/template.
Hello,
This library is currently using
github.com/go-ozzo/ozzo-validation, butgithub.com/go-ozzo/ozzo-validationis usingtext/templateto generate some error messages.text/templateis defeating the Dead Code Elimination (DCE) optimization (this is a known problem).Simple example, with only one file:
Compilation with
github.com/go-ozzo/ozzo-validation:Compilation with an altered version of
github.com/go-ozzo/ozzo-validationwithouttext/template:As you can see, the size of the binary is decreased by ~40% when not using
text/template.It could be great if you can remove
github.com/go-ozzo/ozzo-validationor use a fork withouttext/template.