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

Update the document to include the code formatter #3203

Merged
Merged
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
31 changes: 29 additions & 2 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ _Note: If you're not using `KinD`, you can skip this step._
kind create cluster
```

Alternatively you can use [./hack/create-kind-cluster.sh](hack/create-kind-cluster.sh) to setup a kind cluster with a local registry. This local registry will then be available by default at `localhost:5001`.
Alternatively you can use [./hack/create-kind-cluster.sh](hack/create-kind-cluster.sh) to setup a kind cluster with a
local registry. This local registry will then be available by default at `localhost:5001`.

```shell
./hack/create-kind-cluster.sh
Expand All @@ -44,7 +45,8 @@ export KO_DOCKER_REPO=docker.io/<username>

_Note: replace `<username>` with your username._

In case you setup `KinD` via [./hack/create-kind-cluster.sh](hack/create-kind-cluster.sh), the local registry is available at `localhost:5001`:
In case you setup `KinD` via [./hack/create-kind-cluster.sh](hack/create-kind-cluster.sh), the local registry is
available at `localhost:5001`:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are performed by the formatter.


```shell
export KO_DOCKER_REPO=localhost:5001
Expand Down Expand Up @@ -174,6 +176,31 @@ This step is required only if we're changing a protobuf definition file, or for

If you're unsure, whether you need to run it or not for your changes, run [our build tests](#run-build-tests).

## Code Formatting

### Go

We are using [go fmt](https://pkg.go.dev/fmt) to format our Go code. To format your code, run the following
command within the `control-plane` directory:

```shell
go fmt ./...
```

### Java

We are using Spotless to format our Java code. To format your code, run the following command within the `data-plane`
directory:

```shell
mvn spotless:apply
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this is better because we don't require a maven installation

Suggested change
mvn spotless:apply
./mvnw spotless:apply

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omg that's soo fast loll, haven't updated it yet and it got merged. Prow you did a great job

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's all good!

```

You can also configure it to your IDE. For more information, please refer
to [Spotless](https://github.com/diffplug/spotless).

This action is also performed **automatically** when you run `./hack/run.sh generate`.

## Teardown

### Delete dependencies
Expand Down