Use go build instead of go run for example app (#127)

Using go run $GOPATH/src/github.com/google/jsonapi/examples/app.go as
shown in the Readme, leads to errors (#126) since go run requires all
the .go files of a program.

This commit changes the Readme to show how to run the example app using
go build to avoid this issue.
This commit is contained in:
Stratos Neiros 2018-03-13 02:54:39 +02:00 committed by Aren Patel
parent e0fc4eed33
commit bf4e01db8d
1 changed files with 4 additions and 4 deletions

View File

@ -76,7 +76,7 @@ all of your data easily.
[examples/app.go](https://github.com/google/jsonapi/blob/master/examples/app.go) [examples/app.go](https://github.com/google/jsonapi/blob/master/examples/app.go)
This runnable file demonstrates the implementation of a create, a show, This program demonstrates the implementation of a create, a show,
and a list [http.Handler](http://golang.org/pkg/net/http#Handler). It and a list [http.Handler](http://golang.org/pkg/net/http#Handler). It
outputs some example requests and responses as well as serialized outputs some example requests and responses as well as serialized
examples of the source/target structs to json. That is to say, I show examples of the source/target structs to json. That is to say, I show
@ -85,13 +85,13 @@ turned it into your struct types.
To run, To run,
* Make sure you have go installed * Make sure you have [Go installed](https://golang.org/doc/install)
* Create the following directories or similar: `~/go` * Create the following directories or similar: `~/go`
* Set `GOPATH` to `PWD` in your shell session, `export GOPATH=$PWD` * Set `GOPATH` to `PWD` in your shell session, `export GOPATH=$PWD`
* `go get github.com/google/jsonapi`. (Append `-u` after `get` if you * `go get github.com/google/jsonapi`. (Append `-u` after `get` if you
are updating.) are updating.)
* `go run $GOPATH/src/github.com/google/jsonapi/examples/app.go` or `cd * `cd $GOPATH/src/github.com/google/jsonapi/examples`
$GOPATH/src/github.com/google/jsonapi/examples && go run app.go` * `go build && ./examples`
## `jsonapi` Tag Reference ## `jsonapi` Tag Reference