vkngwrapper / core

vkng wrapper - vulkan core 1.0-1.2
MIT License
30 stars 2 forks source link

Unnecessary dependencies in go.sum and binary #2

Closed mgustavsson closed 1 year ago

mgustavsson commented 2 years ago

This is not urgent in any way, but thought I would mention it, in my project I have this in my go.mod:

require (
    github.com/veandco/go-sdl2 v0.4.24
    github.com/vkngwrapper/core v1.0.5
    github.com/vkngwrapper/extensions v1.0.4
    github.com/vkngwrapper/integrations/sdl2 v1.0.4
)

And this results in a huge go.sum of 394 lines including things like "google.golang.org/grpc", "github.com/valyala/fasthttp" and "github.com/coreos/etcd" etc..

Most of these things are not included in my binary, but here is the list of things that are included and it does include some things which seem unnecessary:

go list -deps -f '{{define "M"}}{{.Path}}@{{.Version}}{{end}}{{with .Module}}{{if not .Main}}{{if .Replace}}{{template "M" .Replace}}{{else}}{{template "M" .}}{{end}}{{end}}{{end}}' | sort -u
github.com/CannibalVox/cgoparam@v1.0.0
github.com/cockroachdb/errors@v1.9.0
github.com/cockroachdb/logtags@v0.0.0-20211118104740-dabe8e521a4f
github.com/cockroachdb/redact@v1.1.3
github.com/getsentry/sentry-go@v0.13.0
github.com/gogo/protobuf@v1.3.2
github.com/google/uuid@v1.3.0
github.com/kr/pretty@v0.3.0
github.com/kr/text@v0.2.0
github.com/pkg/errors@v0.9.1
github.com/rogpeppe/go-internal@v1.8.1
github.com/veandco/go-sdl2@v0.4.24
github.com/vkngwrapper/core@v1.0.5
github.com/vkngwrapper/extensions@v1.0.4
github.com/vkngwrapper/integrations/sdl2@v1.0.4
golang.org/x/sys@v0.0.0-20220808155132-1c4a2a72c664

I think all of this stuff might come from github.com/cockroachdb/errors (?) so maybe that package could be swapped out for something simpler like just the standard errors package https://pkg.go.dev/errors which already provides error wrapping functionality.

CannibalVox commented 2 years ago

The errors package doesn't include stack traces, which are important to me. I originally shied away from github.com/pkg/errors because it's archived. However, after exploring this a little bit, it looks like pkg/errors is the package that provides the base error functionality in cockroachdb/errors in the first place. So, I will move to pkg/errors.

mgustavsson commented 2 years ago

I see - much appreciated, thanks!

mewmew commented 1 year ago

The errors package doesn't include stack traces, which are important to me. I originally shied away from github.com/pkg/errors because it's archived. However, after exploring this a little bit, it looks like pkg/errors is the package that provides the base error functionality in cockroachdb/errors in the first place. So, I will move to pkg/errors.

I've been using pkg/errors for a long time and it has been very stable API-wise. It provides stack traces for errors but doesn't include unnecessary dependencies. So, I can wholeheartedly vouch for the use of pkg/errors for use in vkng/core.

I had a similar concern as @mgustavsson, as it seems many of the dependencies pulled in by vkng doesn't seem required for it's functionality. And if it boils down to the use of cockroachdb/errors for stack traces of errors, then making the switch to pkg/errors makes perfect sense.

@CannibalVox, I also wanted to take the chance to say thank you for working on this collection of packages. It is obvious the amount of dedication and care you've put into them, and as someone who is entertaining the idea of writing games in Go, I am very grateful that you've released these packages to the larger Go community.

So, once more. Thank you for your dedication.

With cheerful regards, Robin

CannibalVox commented 1 year ago

Thank you for the kind words! The VMA port isn't quite ready for prime time (no automated tests, no documentation, some debugging functionality not implemented), but it it does appear to be basically working so I will be making it public in the next day or so. I hope that makes it easier for you to try out vkng for whatever you might be considering!

CannibalVox commented 1 year ago

It's up- here it is https://github.com/vkngwrapper/arsenal