Workspaces
Workspaces is a relatively new Go feature. When you are working in workspace mode, you are allowed to work on multiple modules simultaneously. A Go Workspace contains both source files and compiled binaries. As usual, you are not obliged to use workspaces if you do not want to.
Fortunately, Go is flexible and allows the developer to make their own decisions. However, knowing the features of Go is important, even if you do not want to use them all the time. Not all Go features are for everyone.
When using Go workspaces, you control all dependencies using a file named go.work
, which is located in the root directory of the workspace. Inside go.work
, there exist use
and replace
directives that override the information found in the go.mod
files of the directories of the workspace—this saves you from having to manually edit go.mod
files.
Let us now look at an example of the use of workspaces. Imagine that we want to further develop the sqlite06
package while...