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

Reduce number of dependencies #39

Open
kyleconroy opened this issue May 13, 2019 · 4 comments
Open

Reduce number of dependencies #39

kyleconroy opened this issue May 13, 2019 · 4 comments

Comments

@kyleconroy
Copy link

kyleconroy commented May 13, 2019

I recently created a new project that used this project.

mkdir new-project
cd new-project
go mod init .
go get github.com/kevinburke/twilio-go

Bringing this library into the project results in the following modules being added to go.mod

module .

go 1.12

require (
	github.com/go-stack/stack v1.8.0 // indirect
	github.com/golang/protobuf v1.3.1 // indirect
	github.com/inconshreveable/log15 v0.0.0-20180818164646-67afb5ed74ec // indirect
	github.com/kevinburke/go-types v0.0.0-20181103050146-31250f49d75a // indirect
	github.com/kevinburke/go.uuid v1.2.0 // indirect
	github.com/kevinburke/rest v0.0.0-20190424050029-77c0c82d0ded // indirect
	github.com/kevinburke/twilio-go v0.0.0-20181202201842-113f30c37433 // indirect
	github.com/mattn/go-colorable v0.1.1 // indirect
	github.com/mattn/go-isatty v0.0.7 // indirect
	github.com/ttacon/builder v0.0.0-20170518171403-c099f663e1c2 // indirect
	github.com/ttacon/libphonenumber v1.0.1 // indirect
	golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect
	gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce // indirect
)

protobuf support appears to come from libphonenumber, which seems reasonable.

Any idea why this requires mgo?

@kgolding
Copy link

Ouch - just added this (very useful) repo in a project and it put 3MB on the binary (and that's with -ldflags s -w). Am just looking at how to slim it down.

@kgolding
Copy link

kgolding commented May 24, 2019

Looking like "github.com/ttacon/libphonenumber" is a large culprit. This commit below, moving the PhoneNumber methods out has made a ~40% binary size reduction: kgolding@2382148

@kevinburke
Copy link
Owner

kevinburke commented May 24, 2019 via email

@kgolding
Copy link

It's only NewPhoneNumber(), and the .Friendly() and .Local() methods that use the libphonenumber dependency. PhoneNumber is just an alias of string.

And these three only seem to be used in the tests :)

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

3 participants