Sometimes I need only a function from a package so importing the whole package doesn't seem performance wise. Thus the question: Is it possible to import only a function ?
No, this is not possible.
No, this has no impact on performance. Unused stuff from a package should be dropped by the linker so it won't clutter your binary.
Agree with @Volker that its not possible and that it would not clutter your binary. Some further considerations if you are still keep on only having the package are that the package could be Forked. Whereas if its a library from Go the source code is all available for view and you can get plenty of ideas about how you can implement you own equivalent function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With