Skip to content

LoadAll significantly increases code size #76

@justfalter

Description

@justfalter

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions