Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use $GOPATH in instructions. #512

Merged
merged 1 commit into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ capnpc-go provides the compiler backend for capnp.

# First, install capnpc-go to $PATH.
go install capnproto.org/go/capnp/v3/capnpc-go
# Then, check out the go-capnp source code:
git clone https://github.com/capnproto/go-capnp /desired/path/to/go-capnp
# Then, generate Go files.
capnp compile -I$GOPATH/src/capnproto.org/go/capnp/v3/std -ogo *.capnp
capnp compile -I /desired/path/to/go-capnp/std -ogo *.capnp

capnpc-go requires two annotations for all files: package and import.
package is needed to know what package to place at the head of the
Expand Down
14 changes: 11 additions & 3 deletions docs/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@

First, [install the Cap'n Proto tools](https://capnproto.org/install.html).

Then, run the following commands to install the compiler plugin for the Go language:
Then, run the following command to install the compiler plugin for the
Go language:

```bash
$ go install capnproto.org/go/capnp/v3/capnpc-go@latest # install go compiler plugin
$ GO111MODULE=off go get -u capnproto.org/go/capnp/v3/ # install go-capnproto to $GOPATH
```

Lastly, ensure `$GOPATH/bin` has been added to your shell's `$PATH` variable.
This will install a `capnpc-go` executable under `$(go env GOPATH)/bin`,
which you should make sure has been added to your shell's `$PATH` variable.

You will also need a checkout of of the `go-capnp` repository, for the
included schema:

```
$ git clone https://github.com/capnproto/go-capnp
```

If you get stuck at any point, please [ask us for help](https://matrix.to/#/#go-capnp:matrix.org)!

Expand Down
2 changes: 1 addition & 1 deletion docs/Remote-Procedure-Calls-using-Interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ interface Arith {

Now, compile the schema as before:
```bash
capnp compile -I$GOPATH/src/capnproto.org/go/capnp/std -ogo arith.capnp
capnp compile -I /path/to/go-capnp/std -ogo arith.capnp
```

You should take a moment to inspect the generated types in `arith.capnp.go`. For interface declarations in your schema, the capnp compiler generates several types, summarized in the following tables.
Expand Down
2 changes: 1 addition & 1 deletion docs/Writing-Schemas-and-Generating-Code.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Compilation will fail unless these annotations are present.
To compile this schema into Go code, run the following command. Note that the source path `/foo/books.capnp` must correspond to the import path declared in your annotations.

```bash
capnp compile -I$GOPATH/src/capnproto.org/go/capnp/std -ogo foo/books.capnp
capnp compile -I /path/to/go-capnp/std -ogo foo/books.capnp
```

> **Tip** 👉 For more compilation options, see `capnp compile --help`.
Expand Down
4 changes: 2 additions & 2 deletions example/books/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ capnproto schema:

```
cd $GOPATH/src/go-capnproto2/example/books
capnp compile -I/home/johnk/go/src/capnproto.org/go/capnp/std/ -ogo books/books.capnp
capnp compile -I ../../std/ -ogo books/books.capnp
```

Then build and run each example:
```
cd ex1 && go build . && ./bookstest1

cd ex2 && go build . && capnp encode ../books/books.capnp Book < ./book.txt | ./bookstest2 && cd ..
```
```
8 changes: 4 additions & 4 deletions example/hashes/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
cd to wherever you installed the source, for example:
cd to wherever you installed the source:

`cd $GOPATH/src/go-capnproto2/example/hashes`
`cd /path/to/go-capnp/example/hashes`

Compile the capnp file:

`capnp compile -I$GOPATH/src/capnproto.org/go/capnp/std/ -ogo hashes/hashes.capnp`
`capnp compile -I ../../std/ -ogo hashes.capnp`

Build your code, and run it:

```
go build .
./hashtest
```
```