Generate 'go.work' for a Project

Generate 'go.work' by using the context menu or a quick-fix with 'replace' directives.

Right-click the root folder of your project and navigate to New | Go Workspace File. When you select it, a go.work file will appear in your root folder. Existing Go modules will automatically be added to the go.work file.

Also, you can generate go.work from go.mod if you have replace directives there. Place the caret on a replace directive, press ⌥⏎ (macOS) / Alt+Enter (Windows/Linux) to see all available intention actions, and select the Generate ‘go.work’ using ‘replace’ directives quick-fix.


Related Resources

Improve Code Readability and Navigation
Improve Code Readability and Navigation
Discover how to manage code visibility with code folding in Go
Create a Function in Another Package
Create a Function in Another Package
Type a non-existing function name and generate its implementation in a package of your choice.
Empower your `Printf`-like functions with coding assistance
Empower your `Printf`-like functions with coding assistance
Provide hints and highlights for message formats in custom `Printf`-like functions.