Go project directory

Hello everyone! I start learning go but dont understand what is the project directory for this? I mean for OS.

You can easily start with Go modules. Please see the official guide to get started.

HI @a_4_ppl_a_4_ppl,

Your project directory is wherever a go.mod file is.

For new projects, run go mod init <path-to-hosted-repository> to initialize a project. The path should be a hosted repository so that the project is accessible outside your local disk.

If your project is a library, the path is used by import statements to import packages from your library.

Call go env GOPATH to see the path to the GOPATH directory that holds compilation artifacts and cached repositories. If you have a document that says that GOPATH is the single workspace for all your Go projects, then this document is obsolete since the introduction of Go Modules.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.