Skip to content

Commit

Permalink
Go: Ignore Go workspace file go.work
Browse files Browse the repository at this point in the history
With Go 1.18, support for Go workspaces will land.
Go workspaces are configured in `go.work`, which
contains paths to local development versions of
modules and therefore is not expected to be
commited.

See:
* golang/go#45713
  • Loading branch information
breml committed Nov 13, 2021
1 parent cdd9e94 commit fbc053f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Go.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work

4 comments on commit fbc053f

@robsonpeixoto
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is missing go.work.sum

@davidrenne
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robsonpeixoto @breml why would you ignore a go.work and go.work.sum file? If I am working on a project I typically keep them checked in so you can debug individual modules and so gopls works properly when modules are nested. Just trying to learn here as I would think its helpful to other developers to have the go.work setup so they dont have to point each directory on their checked out repo.

@breml
Copy link
Contributor Author

@breml breml commented on fbc053f Feb 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidrenne For more details about the reasoning see the PR: #3884 (comment)

@davidrenne
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @breml, will read more of the proposal. Perhaps in many of my cases gopls is needing go.work to be configured pointing to other sub modules in order to not be confused. Some of the examples from the proposal talk about doing replacements which obviously are needing to be local paths of a local machine and to be ignored, but there are certainly cases where I think this file is to be checked in so things like vscode can work with multiple modules without the case of a replace.

Have a great week!

Please sign in to comment.