Skip to content

x/website: outdated info about workspace and modules? #35919

@mindplay-dk

Description

@mindplay-dk

The Getting Started page talks about setting up your workspace:

Check that Go is installed correctly by setting up a workspace and building a simple program, as follows.

Create your workspace directory, %USERPROFILE%\go. (If you'd like to use a different directory, you will need to set the GOPATH environment variable.)

It links to the "Workspaces" section in How To Write Go Code, which explains a number of things:

Go programmers typically keep all their Go code in a single workspace.

Do they still do that today?

Note that this differs from other programming environments in which every project has a separate workspace and workspaces are closely tied to version control repositories.

Is that still true?

These pages explain how to set up your workspace and GOPATH, etc. - how to create your first program and library in the workspace, how to install packages, and so on.

Modules and go mod are never even mentioned.

The Go 1.11 release notes stated:

Using modules, developers are no longer confined to working inside GOPATH, version dependency information is explicit yet lightweight, and builds are more reliable and reproducible.

That sounds great. Why isn't this the prescribed way to get started?

I found a useful introduction to go modules on this website, but (beyond the 1.11 announcement post) I haven't really seen modules mentioned or promoted anywhere on the official website.

With support for modules proper, it seems like this should be the preferred approach - the role of the global workspace should be reduced to global installations of tools and so forth, as is the case with most common package managers for other languages? (npm, etc.)

When the official documentation tells me that Go programmers "typically" keep all their Go code in a single workspace, that makes me feel insecure about even learning about modules.

Is a single, global workspace still the preferred/recommended approach?

Or why aren't you promoting the use of modules?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions