From 44b0789a5154b79e8a61f1b7b977075eb780e4d7 Mon Sep 17 00:00:00 2001 From: Kyle Quest Date: Sat, 8 Sep 2018 08:56:21 -0700 Subject: [PATCH] more context around the /src directory --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 529afbe..29e3a30 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,8 @@ Other assets to go along with your repository. Some Go projects do have a `src` folder, but it usually happens when the devs came from the Java world where it's a common pattern. If you can help yourself try not to adopt this Java pattern. You really don't want your Go code or Go projects to look like Java :-) +Don't confuse the project level `/src` directory with the `/src` directory Go uses for its workspaces as described in [`How to Write Go Code`](https://golang.org/doc/code.html). The `$GOPATH` environment variable points to your (current) workspace (by default it points to `$HOME/go` on non-windows systems). This workspace includes the top level `/pkg`, `/bin` and `/src` directories. Your actual project ends up being a sub-directory under `/src`, so if you have the `/src` directory in your project the project path will look like this: `/some/path/to/workspace/src/your_project/src/your_code.go`. Note that with Go 1.11 it's possible to have your project outside of your `GOPATH`, but it still doesn't mean it's a good idea to use this layout pattern. + ## Badges