diff --git a/Brewfile b/Brewfile new file mode 100644 index 00000000..577e34a4 --- /dev/null +++ b/Brewfile @@ -0,0 +1 @@ +brew "go" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 92db773a..e2120a65 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,15 @@ ## Setting up the environment -### Install Go 1.18+ +To set up the repository, run: -Install go by following relevant directions [here](https://go.dev/doc/install). +```sh +$ ./scripts/bootstrap +$ ./scripts/build +``` + +This will install all the required dependencies and build the SDK. + +You can also [install go 1.18+ manually](https://go.dev/doc/install). ## Modifying/Adding code @@ -14,7 +21,7 @@ modify the contents of the `lib/` and `examples/` directories. All files in the `examples/` directory are not modified by the generator and can be freely edited or added to. -```bash +```go # add an example to examples//main.go package main @@ -24,8 +31,8 @@ func main() { } ``` -```bash -go run ./examples/ +```sh +$ go run ./examples/ ``` ## Using the repository from source @@ -33,27 +40,27 @@ go run ./examples/ To use a local version of this library from source in another project, edit the `go.mod` with a replace directive. This can be done through the CLI with the following: -```bash -go mod edit -replace github.com/openai/openai-go=/path/to/openai-go +```sh +$ go mod edit -replace github.com/openai/openai-go=/path/to/openai-go ``` ## Running tests Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. -```bash +```sh # you will need npm installed -npx prism mock path/to/your/openapi.yml +$ npx prism mock path/to/your/openapi.yml ``` -```bash -go test ./... +```sh +$ ./scripts/test ``` ## Formatting This library uses the standard gofmt code formatter: -```bash -gofmt -s -w . +```sh +$ ./scripts/format ``` diff --git a/README.md b/README.md index a3ea8e71..58e24a79 100644 --- a/README.md +++ b/README.md @@ -405,3 +405,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. We are keen for your feedback; please open an [issue](https://www.github.com/openai/openai-go/issues) with questions, bugs, or suggestions. + +## Contributing + +See [the contributing documentation](./CONTRIBUTING.md).