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

x/tools/gopls: update unstable version installation instruction #46880

hyangah opened this issue Jun 22, 2021 · 6 comments

x/tools/gopls: update unstable version installation instruction #46880

hyangah opened this issue Jun 22, 2021 · 6 comments
gopls Tools


Copy link

@hyangah hyangah commented Jun 22, 2021

Neither works quietly. In favor of the experimental workspace module option, can we remove the use of replace?

~$ gotip get
go: downloading v0.0.0-20210622191215-6d3e43932267
go: downloading v0.1.4-0.20210622191215-6d3e43932267
go get: installing executables with 'go get' in module mode is deprecated.
	Use 'go install pkg@version' instead.
	For more information, see
	or run 'go help get' or 'go help install'.

~$ gotip install
go install: (in
	The go.mod file for the module providing named packages contains one or
	more replace directives. It must not contain directives that would cause
	it to be interpreted differently than if it were the main module.
@gopherbot gopherbot added Tools gopls labels Jun 22, 2021
@gopherbot gopherbot added this to the Unreleased milestone Jun 22, 2021
Copy link

@ianthehat ianthehat commented Jun 23, 2021

I vote we remove the replace and all attempt to use the new experimental file instead to see if it solves the workflow well for us.

@suzmue suzmue removed this from the Unreleased milestone Jun 24, 2021
@suzmue suzmue added this to the gopls/unplanned milestone Jun 24, 2021
@suzmue suzmue removed this from the gopls/unplanned milestone Jun 25, 2021
@suzmue suzmue added this to the gopls/v1.0.0 milestone Jun 25, 2021
@stamblerre stamblerre added this to To Do in gopls on-deck Jul 15, 2021
@stamblerre stamblerre moved this from To Do to P3 in gopls on-deck Aug 12, 2021
Copy link

@pwaller pwaller commented Oct 1, 2021

Following the instructions on working with generic code, I hit this error message during install. Not clear what the right course of action is, would appreciate advice. (It also seems worthwhile to update that instruction!)

Copy link
Contributor Author

@hyangah hyangah commented Oct 4, 2021

@pwaller please follow the instruction @jayconrod described in #43684 (comment)

# Create an empty go.mod file, only for tracking requirements.
cd $(mktemp -d)
go mod init empty-module-for-installing-a-tool

# Use 'go get' to add requirements and to ensure they work together.
go get

# Install using the selected versions in go.mod.
go install

Actually, the above instruction should be the new instruction for unstable version installation until we migrate to a separate repository with one module. (cc @stamblerre @ianthehat @findleyr )

I considered removing replace directive, but even without replace, I doubt go install would behave as we hoped - go install doesn't support changing dependencies versions AFAIK. go install may be building a version of gopls neither its developers nor the builders built/tested. is designed for developers (who check out the source in the local directory), so I don't think that supports this use case.

Alternatives I considered were

  1. keep the current replace directive and ask users to git clone; cd tools/gopls; go install ., or
  2. check in in x/tools and ask users to git clone; cd tools; go build -o gopls-unstable ./gopls. (note: go install won't work here).

But gopls built in these ways won't have complete version info (runtime/debug.BuildInfo) due to #29228 - which will be less ideal for gopls&vscode-go maintainers when triaging issues.

Copy link

@gopherbot gopherbot commented Oct 5, 2021

Change mentions this issue: gopls/doc/ update unstable version installation instruction

gopherbot pushed a commit to golang/tools that referenced this issue Oct 7, 2021
`go get` no longer builds/installs binaries in tip.

Updates golang/go#46880

Change-Id: I5673368a579d79f571adf5ca5c44c15b8101dbe9
Trust: Hyang-Ah Hana Kim <>
Reviewed-by: Rebecca Stambler <>
Copy link
Contributor Author

@hyangah hyangah commented Oct 7, 2021

The new instruction based on #46880 (comment) is complicated and not user friendly. We plan to look into a way to simplify it. Current ideas:

  • Provide a script to do the work, or
  • Let gopls handle installation of it. e.g. gopls get unstable or gopls install unstable which runs the sequence of go commands and the dummy main module creation.

@hyangah hyangah self-assigned this Oct 8, 2021
@stamblerre stamblerre assigned stamblerre and unassigned hyangah and stamblerre Oct 15, 2021
Copy link
Contributor Author

@hyangah hyangah commented Mar 17, 2022

If #50603 is implemented, we can just utilize
git clone -> checkout to the wanted commit -> go install from the gopls directory.

That will achieve:

  • pick up the replace formula described as in the go.mod.
  • produce a binary with the version info other than (dev).
  • place the built binary to the default go install directory.
  • the new instruction is more user-friendly: users know git clone and go install.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
gopls Tools
No open projects

No branches or pull requests

6 participants