DEV Community

Evan Lin
Evan Lin

Posted on • Originally published at evanlin.com on

Golang: Trying out Go Proposal 45713 'Multi-Module Workspaces'

title: [Learning Notes][Golang: Gotip] Quick Taste of Go Proposal 45713 'Multi-Module Workspaces'
published: false
date: 2021-08-19 00:00:00 UTC
tags: 
canonical_url: http://www.evanlin.com/go-workspaces/
---

![image-20210819214237647](http://www.evanlin.com/images/2021/image-20210819214237647.png)

- Proposal: [45713 Workspace Mode](https://go.googlesource.com/proposal/+/master/design/45713-workspace.md)
- PR: [45713](https://github.com/golang/go/issues/45713)
- Demo Video: [YouTube](https://www.youtube.com/watch?v=wQglU5aB5NQ)

# Summary

Vendoring and Dependency Management are problems Golang has been trying to solve. Through `go mod`, you can manage the first layer of packages. With `go mod vendor`, you can download the related dependent packages in the local `vendor/`. If you want to modify the upper layer of dependency, you can modify it directly. But what if you want to modify the files of the dependency's upper layer and its even upper layer?

In the past, you could modify them one by one through `go mod edit`, but it would be quite complex once there are many files. Is there any way to quickly make some confirmations locally, so that it's easier to submit a PR to upstream? Here, we introduce a feature that is undergoing final review (if approved, it's expected to be a go 1.18 feature: Multi-Module Workspaces).

The proposal author is very thoughtful and also released a Demo Video with a big dog. I must say, because there's a cute big dog, I obediently finished reading the proposal.

<iframe width="560" height="315" src="https://www.youtube.com/embed/wQglU5aB5NQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
# How to Install

Enter fullscreen mode Exit fullscreen mode

# Get the latest version of golang source code

go install golang.org/dl/gotip@latest

Download gotip based on a certain CL

gotip download dev.cmdgo

Look at the modified related commands, pay attention to initwork, editwork ...

gotip help mod

The commands are:

download download modules to local cache
edit edit go.mod from tools or scripts
editwork edit go.work from tools or scripts
graph print module requirement graph
init initialize new module in current directory
initwork initialize workspace file
tidy add missing and remove unused modules
vendor make vendored copy of dependencies
verify verify dependencies have expected content
why explain why packages or modules are needed
Enter fullscreen mode Exit fullscreen mode

## Related Articles:

- [45713 Workspace Mode](https://go.googlesource.com/proposal/+/master/design/45713-workspace.md)
- [Demo Video YouTube](https://www.youtube.com/watch?v=wQglU5aB5NQ)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)