summaryrefslogtreecommitdiff
path: root/goplus.md
diff options
context:
space:
mode:
Diffstat (limited to 'goplus.md')
-rw-r--r--goplus.md29
1 files changed, 16 insertions, 13 deletions
diff --git a/goplus.md b/goplus.md
index c9b0191..e6d9f85 100644
--- a/goplus.md
+++ b/goplus.md
@@ -1,16 +1,19 @@
# Go and project root
-Compared to other languages go has some strange behavior regarding its project root settings. If you
-import a library called `somelib`, go will look for a `src/somelib` folder in all of the folders in
-the `$GOPATH` environment variable. This works nicely for globally installed packages, but it makes
-encapsulating a project with a specific version, or modified version, rather tedious. Whenever you go
-to work on this project you'll have to add its path to your `$GOPATH`, or add the path permanently,
-which could break other projects which may use a different version of `somelib`.
-
-My solution is in the form of a simple script I'm calling go+. go+ will search in currrent directory
-and all of its parents for a file called `GOPROJROOT`. If it finds that file in a directory, it
-prepends that directory's absolute path to your `$GOPATH` and stops the search. Regardless of whether
-or not `GOPROJROOT` was found go+ will passthrough all arguments to the actual go call. The
+Compared to other languages go has some strange behavior regarding its project
+root settings. If you import a library called `somelib`, go will look for a
+`src/somelib` folder in all of the folders in the `$GOPATH` environment
+variable. This works nicely for globally installed packages, but it makes
+encapsulating a project with a specific version, or modified version, rather
+tedious. Whenever you go to work on this project you'll have to add its path to
+your `$GOPATH`, or add the path permanently, which could break other projects
+which may use a different version of `somelib`.
+
+My solution is in the form of a simple script I'm calling go+. go+ will search
+in currrent directory and all of its parents for a file called `GOPROJROOT`. If
+it finds that file in a directory, it prepends that directory's absolute path to
+your `$GOPATH` and stops the search. Regardless of whether or not `GOPROJROOT`
+was found go+ will passthrough all arguments to the actual go call. The
modification to `$GOPATH` will only last the duration of the call.
As an example, consider the following:
@@ -23,8 +26,8 @@ As an example, consider the following:
/hello.go
```
-If `hello.go` depends on `somelib`, as long as you run go+ from `/tmp/hello` or one of its children
-your project will still compile
+If `hello.go` depends on `somelib`, as long as you run go+ from `/tmp/hello` or
+one of its children your project will still compile
Here is the source code for go+: