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

[epic] Remove GOPATH for go modules formula #47627

Closed
chenrui333 opened this issue Dec 8, 2019 · 47 comments
Closed

[epic] Remove GOPATH for go modules formula #47627

chenrui333 opened this issue Dec 8, 2019 · 47 comments
Labels
go Go use is a significant feature of the PR or issue good first issue A good candidate for your first contribution to Homebrew/homebrew-core gopath deprecation Deprecate GOPATH in favor of Go Modules help wanted Task(s) needing PRs from the community or maintainers outdated PR was locked due to age

Comments

@chenrui333
Copy link
Member

Historically, golang builds need to happen under the GOPATH, as more and more formula has moved to go-modules, we can deprecate the GOPATH usage.

@jonchang
Copy link
Contributor

jonchang commented Dec 8, 2019

Looks like there are 291 formula that still use GOPATH.

  • acmetool
  • ahoy
  • akamai
  • algernon
  • aliyun-cli
  • alp
  • amazon-ecs-cli
  • annie
  • antibody
  • anycable-go
  • apache-brooklyn-cli
  • apm-server
  • aptly
  • armor
  • assh
  • atlantis
  • auditbeat
  • aurora
  • aws-es-proxy
  • aws-iam-authenticator
  • aws-okta
  • benthos
  • bettercap
  • bitrise
  • borg
  • buildkit
  • c14-cli
  • calicoctl
  • cayley
  • certstrap
  • cf-tool
  • cfssl
  • chamber
  • charm
  • chronograf
  • cig
  • circleci
  • cli53
  • clipper
  • cointop
  • collector-sidecar
  • consul-backinator
  • consul-template
  • consul
  • container-diff
  • convox
  • corectl
  • cql
  • ctop
  • cwlogs
  • dashing
  • dcos-cli
  • deis
  • deisctl
  • dep
  • devd
  • devspace
  • direnv
  • dive
  • dnscontrol
  • dnscrypt-proxy
  • docker-credential-helper-ecr
  • docker-credential-helper
  • docker-gen
  • docker-ls
  • docker-machine-driver-hyperkit
  • docker-machine-driver-vmware
  • docker-machine-driver-vultr
  • docker-machine-parallels
  • docker-machine
  • docker-swarm
  • docker
  • docker2aci
  • dockerize
  • dockviz
  • dockward
  • doctl
  • drone-cli
  • dvm
  • elvish
  • emp
  • envconsul
  • etcd
  • exercism
  • faas-cli
  • fabio
  • filebeat
  • fleetctl
  • flint-checker
  • fluxctl
  • fn
  • forego
  • fork-cleaner
  • fortio
  • frpc
  • frps
  • frugal
  • fsql
  • gauge
  • gdm
  • gdrive
  • geoipupdate
  • ghr
  • git-appraise
  • git-sizer
  • git-town
  • github-markdown-toc
  • github-release
  • gitlab-runner
  • glide
  • glooctl
  • go-bindata
  • go-jira
  • go-md2man
  • go
  • go@1.10
  • go@1.11
  • go@1.12
  • go@1.9
  • goad
  • gobuster
  • gocryptfs
  • gofabric8
  • gollum
  • gomplate
  • goose
  • gopass
  • gor
  • goreman
  • gost
  • gotags
  • govendor
  • gowsdl
  • gox
  • grafana
  • gron
  • grv
  • gx-go
  • gx
  • heartbeat
  • helm
  • helm@2
  • helmsman
  • hey
  • hivemind
  • hostess
  • hub
  • iamy
  • immortal
  • influxdb
  • infrakit
  • inlets
  • ipfs
  • iron-functions
  • ironcli
  • istioctl
  • jabba
  • jd
  • jfrog-cli-go
  • jid
  • jp
  • juju
  • jump
  • jvgrep
  • k3d
  • k6
  • kapacitor
  • karn
  • kedge
  • kompose
  • kops
  • kube-aws
  • kubeaudit
  • kubebuilder
  • kubeless
  • kubeprod
  • kubernetes-cli
  • kubernetes-service-catalog-client
  • kyma-cli
  • landscaper
  • lean-cli
  • leaps
  • lego
  • lf
  • linkerd
  • lxc
  • mage
  • mailhog
  • massren
  • megacmd
  • metricbeat
  • micro
  • minio-mc
  • minio
  • mmark
  • modd
  • mpdviz
  • nats-server
  • nats-streaming-server
  • node_exporter
  • nomad
  • nsq
  • oauth2_proxy
  • octant
  • opa
  • openshift-cli
  • operator-sdk
  • overmind
  • packer
  • peco
  • perkeep
  • pgweb
  • piknik
  • pilosa
  • prest
  • protoc-gen-go
  • prototool
  • pulumi
  • pumba
  • pup
  • qpm
  • rack
  • rancher-cli
  • rancher-compose
  • rke
  • s-search
  • scc
  • scw
  • serve
  • shellz
  • shfmt
  • ship
  • sift
  • skaffold
  • skopeo
  • slackcat
  • slacknimate
  • smimesign
  • snag
  • snap-telemetry
  • sonobuoy
  • spaceinvaders-go
  • srclib
  • ssh-vault
  • ssllabs-scan
  • step
  • stolon
  • stout
  • syncthing-inotify
  • syncthing
  • td
  • teleconsole
  • telegraf
  • teleport
  • termshare
  • terraform-docs
  • terraform-inventory
  • terraform
  • terraform@0.11
  • terraformer
  • terragrunt
  • terrahelp
  • textql
  • the_platinum_searcher
  • traefik
  • traefik@1
  • triangle
  • ultralist
  • uru
  • vault
  • vegeta
  • velero
  • vert
  • virgil
  • virustotal-cli
  • vultr
  • warp
  • websocketd
  • wego
  • wellington
  • wsk
  • wskdeploy
  • wu
  • yq

@alebcay
Copy link
Member

alebcay commented Dec 9, 2019

While we're here - would it be worth standardizing some of the flags that we use for building Go formulae? Specifically, I would advocate for always including

  • -ldflags "-s -w", unless it breaks build
  • -trimpath: "remove all file system paths from the resulting executable. Instead of absolute file system paths, the recorded file names will begin with either "go" (for the standard library), or a module path@version (when using modules), or a plain import path (when using GOPATH)."

@jonchang
Copy link
Contributor

jonchang commented Dec 9, 2019

It looks like Debian sets -trimpath but doesn't strip binaries with -s -w. Would it be useful to add something like std_go_args (like we have for CMake builds)?

@alebcay
Copy link
Member

alebcay commented Dec 9, 2019

Would it be useful to add something like std_go_args (like we have for CMake builds)?

I think it would be useful. I've already seen some formulae floating around with stripped binaries, which is why I've brought this up. From my limited testing with the PRs above, there's a reduction of 15-20% in total formula size. I personally don't think it would be a bad idea to strip binaries, seeing as Go binaries are all statically linked.

@alebcay alebcay changed the title [epic] Remove GOAPTH for go modules formula [epic] Remove GOPATH for go modules formula Dec 9, 2019
@SMillerDev
Copy link
Member

Maybe you want to wait @chenrui333 and do gopath at the same time as the go_std_args?

@chenrui333
Copy link
Member Author

chenrui333 commented Dec 10, 2019

Would it be useful to add something like std_go_args (like we have for CMake builds)?

+1 for std_go_args idea.

We can definitely pipeline the work between std_go_args and gopath removal though.
After that we can refine our template for easy bootstrap golang formula.

@roopakv
Copy link
Contributor

roopakv commented Feb 22, 2021

All right! we are all done ( i think). We have PRs for all the tools listed in @carlocab's comment.

While we have filed issues with a LOT of the tools there I doubt that many of them will actually upgrade to go modules by the time go1.17 is out. Would the idea be to deprecate them or disable them or add a go1.16 formula when that time comes?

@Bo98
Copy link
Member

Bo98 commented Feb 22, 2021

Possibly both - we could deprecate as "unmaintained" if there is no response, but we'll let them depend on go@1.16 for that deprecation period.

I'm very likely going to start tests with 1.17 RC1 when that lands rather than the final version so that we're better prepared.

For 1.16: we just now need to double check a couple of the other failures but they should be easy to prove they are pre-existing or not and then we can rebase on master (with the bootstrap change we agreed on in #71370 (comment)).

@carlocab
Copy link
Member

carlocab commented Feb 22, 2021

Thanks very much for all the help, @roopakv. There are still a handful of formulae that don't use GOPATH but nevertheless did failed with go1.16: #71289 (comment)

@dawidd6 dawidd6 added the good first issue A good candidate for your first contribution to Homebrew/homebrew-core label Jul 18, 2021
@SMillerDev
Copy link
Member

Is this still a problem with current Go versions?

@alebcay
Copy link
Member

alebcay commented Jun 6, 2022

It generally is not a problem (using GOPATH was never broken across the board, just in some corner cases like we've seen in the past); however usage of modern Go modules is definitely preferred. I would consider this on par with a style issue since I don't foresee Go fully disabling the deprecated functionality.

I may make one more pass through the list and post remaining items as a comment (for posterity). We can continue working on it if preferred or close this soon.

@alebcay
Copy link
Member

alebcay commented Jun 7, 2022

Upstream HEAD has module support but has not landed in a release

  • ahoy
  • apache-brooklyn-cli
  • aptly
  • confd
  • devd
  • dockerize
  • go-bindata
  • jabba
  • pup

Upstream is still not using modules yet

Deprecated/disabled

  • cf-tool
  • corectl
  • cosi
  • cwlogs
  • dep
  • docker-machine-driver-hyperkit
  • docker-machine-driver-xhyve
  • docker-machine-driver-vultr
  • docker-machine
  • docker-swarm
  • docker2aci
  • dockward
  • fleetctl
  • gdm
  • glide
  • go@1.13
  • go@1.14
  • goad
  • gofabric8
  • goofys
  • govendor
  • grv
  • gx-go
  • helm@2
  • infrakit
  • ironcli
  • kedge
  • landscaper
  • modd
  • mpdviz
  • qpm
  • rack
  • rancher-compose
  • snap-telemetry
  • stout
  • teleconsole
  • termshare
  • textql
  • terraform@0.11
  • vert

Corner cases

  • docker - upstream uses modules to manage a vendor folder but has no plans to move to a conventional Go modules setup
  • gcsfuse - need a closer look; current approach involves deleting and maybe setting a custom GOPATH?
  • kops - upstream supports modules but the Makefile seems to download the package from k8s.io at build time?
  • operator-sdk - Makefile uses GOBIN to install binaries, but does not use GOPATH
  • perkeep - upstream uses modules but their build system puts the binary in GOPATH/bin (i.e. in HOMEBREW_CACHE/go_mod_cache/bin if we don't set GOPATH)
  • pulumi - Makefile downloads some prebuilt binaries?
  • vault - Makefile downloads its own copy of Homebrew-provided stuff (e.g. gox)

@rahul3002
Copy link

I would like to contribute to this Project

@SMillerDev
Copy link
Member

Go for it

@rahul3002
Copy link

can anyone guide me

@alebcay
Copy link
Member

alebcay commented Sep 20, 2022

Hi @rahul3002, I encourage you to take a look at our contributing guide for info on how to contribute in this repository (Homebrew/homebrew-core), which stores formulae (packages) for Homebrew.

You may also be interested in contributing to the main brew repo (https://github.com/Homebrew/brew), which contains the code for the package manager itself. You can also refer to the contributing guidelines for the brew repo for info on how to contribute there.

You can also find more information relevant to contributing at our docs site. I would ask that you to take further questions to our Discussions forum, as this thread is dedicated to other purposes. Thanks for your interest!

@SMillerDev SMillerDev removed the in progress Stale bot should stay away label Jan 4, 2023
This was referenced Jun 27, 2023
@osalbahr
Copy link
Contributor

osalbahr commented Jul 1, 2023

I see that the "in progress" label was removed but this issue is still open and there is still a "help wanted" label. What does that mean?

@iMichka
Copy link
Member

iMichka commented Aug 13, 2023

Not sure for the in progress label. Looking at it, we have been working on this since 2019 ... so progress has been slow. There are less than 50 formulae where GOPATH could be removed, so any help finishing this task is welcome.

@chenrui333
Copy link
Member Author

Considering now we are at go 1.21, gonna use gopath deprecation for further tracking or formulae deprecations.

@github-actions github-actions bot added the outdated PR was locked due to age label Sep 26, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
go Go use is a significant feature of the PR or issue good first issue A good candidate for your first contribution to Homebrew/homebrew-core gopath deprecation Deprecate GOPATH in favor of Go Modules help wanted Task(s) needing PRs from the community or maintainers outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests