Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoadAll significantly increases code size #76

Open
justfalter opened this issue Aug 6, 2024 · 0 comments
Open

LoadAll significantly increases code size #76

justfalter opened this issue Aug 6, 2024 · 0 comments

Comments

@justfalter
Copy link

Compare the two:

The following compiles to 6.6MB w/ go1.22.5 on osx (arm64)

package main

import (
	"github.com/magiconair/properties"
)

func main() {
	_, err := properties.LoadFile("./config.properties", properties.UTF8)
	if err != nil {
		panic(err)
	}
}

The following compiles to 3.7MB:

package main

import (
	"github.com/magiconair/properties"
)

func main() {
	loader := &properties.Loader{Encoding: properties.UTF8}
	_, err := loader.LoadFile("./config.properties")
	if err != nil {
		panic(err)
	}
}

The reason for this is because properties.LoadFile funnels through Loader.LoadAll, which can load properties files from URLs, so net/http and everything gets pulled in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant