k2tf icon indicating copy to clipboard operation
k2tf copied to clipboard

Support binaries with Homebrew

Open darkn3rd opened this issue 3 years ago • 6 comments

I did a brew install k2tf, and I had to download go and compile the binary. This takes a VERY long time. I expected to just install the compiled binary. It's been 15 minutes, and it is still not completed.

$ brew install k2tf
==> Downloading https://ghcr.io/v2/homebrew/core/go/manifests/1.17
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/go/blobs/sha256:89479b19d41e72c3cd615f92a2c1f408662b7a07a30253feac846bed7e553d3c
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:89479b19d41e72c3cd615f92a2c1f408662b7a07a30253feac846bed7e553d3c?se=2021-09
######################################################################## 100.0%
==> Downloading https://github.com/sl1pm4t/k2tf/archive/v0.5.0.tar.gz
==> Downloading from https://codeload.github.com/sl1pm4t/k2tf/tar.gz/v0.5.0
##O#- #
==> Installing k2tf from sl1pm4t/k2tf
==> Installing dependencies for sl1pm4t/k2tf/k2tf: go
==> Installing sl1pm4t/k2tf/k2tf dependency: go
==> Pouring go--1.17.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/go/1.17: 10,809 files, 565.6MB
==> Installing sl1pm4t/k2tf/k2tf
==> go build

darkn3rd avatar Sep 06 '21 15:09 darkn3rd

Did this finish, and did you get to the bottom of what was causing the slowness?

Is the process also very slow if you "manually" compile from source?

Tested and on Linux things proceeded snappily enough, however Go version below is 1.15.6:

$ time make build
go build -v
go: downloading github.com/rs/zerolog v1.19.0
go: downloading github.com/sirupsen/logrus v1.4.2
go: downloading github.com/hashicorp/terraform-plugin-sdk v1.7.0
...
github.com/hashicorp/terraform-provider-kubernetes/kubernetes
github.com/sl1pm4t/k2tf/pkg/tfkschema
github.com/sl1pm4t/k2tf

real	0m19,306s
user	1m33,964s
sys	0m8,798s

kahara avatar Sep 06 '21 18:09 kahara

Just installed on my laptop.

go version go1.17 darwin/amd64

🍺 /usr/local/Cellar/k2tf/0.5.0: 5 files, 48MB, built in 1 minute 4 seconds

sollie avatar Sep 07 '21 11:09 sollie

@darkn3rd is this an M1 machine?

kahara avatar Sep 07 '21 15:09 kahara

🍺 /usr/local/Cellar/k2tf/0.5.0: 5 files, 48MB, built in 57 seconds

Mine is also pretty fast, I am using MBP Pro 2017. (I think it might be because I have already loaded the dependencies in my go_cache)

chenrui333 avatar Oct 03 '21 03:10 chenrui333

I have a MacBook Air (Retina, 13-inch, 2018), and compiling is slow, especially if the explicit go lang dependency is not met, but seriously as much as would like to endorse the "works on my laptop", it is sort of missing point.

If there is binary releases available in git releases, why not use Homebrew package manager to install, I don't know, a "package", Currently, Homebrew in this scope is used for build tool automation. Go already has this built in with go get.

This is the first project (in the category of using homebrew and go lang with git binary releases available) that I have come across that requires downloading go build environment to compile the binary through a package manager.

darkn3rd avatar Oct 04 '21 09:10 darkn3rd

@darkn3rd I have just merged the k2tf homebrew-core PR , do you want to give another try?

$ brew untap sl1pm4t/k2tf
$ brew update
$ brew reinstall k2tf
==> Downloading https://ghcr.io/v2/homebrew/core/k2tf/manifests/0.5.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/k2tf/blobs/sha256:50ada2c6baf47bc0bf56d7c63075cdc0af7c45efea79589c0bce09d548446247
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:50ada2c6baf47bc0bf56d7c63075cdc0af7c45efea79589c0bce09d548446247?se=2021-10-04T2
######################################################################## 100.0%
==> Reinstalling k2tf
==> Pouring k2tf--0.5.0.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/k2tf/0.5.0: 50 files, 38.6MB

chenrui333 avatar Oct 04 '21 21:10 chenrui333