Skip to content

Commit

Permalink
📝 add documentation for go workspaces (#1758)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-rock authored Sep 18, 2023
1 parent b03fcb7 commit c953ff2
Showing 1 changed file with 44 additions and 5 deletions.
49 changes: 44 additions & 5 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ On macOS systems with Homebrew, run: `brew install [email protected] protobuf`
$ go version
```

If `go` is not installed or an older version exists, follow instructions on [the Go website](https://golang.org/doc/install).
If `go` is not installed or an older version exists, follow instructions
on [the Go website](https://golang.org/doc/install).

2. Clone this repository:

Expand All @@ -40,7 +41,8 @@ If `go` is not installed or an older version exists, follow instructions on [the

## Develop cnquery, providers, or resources

Whenever you change resources, providers, or protos, you must generate files for the compiler. To do this, make sure you have the necessary tools installed (such as protobuf):
Whenever you change resources, providers, or protos, you must generate files for the compiler. To do this, make sure you
have the necessary tools installed (such as protobuf):

```bash
make prep
Expand All @@ -52,11 +54,13 @@ Then, whenever you make changes, just run:
make cnquery/generate
```

This generates and updates all required files for the build. At this point you can `make cnquery/install` again as outlined above.
This generates and updates all required files for the build. At this point you can `make cnquery/install` again as
outlined above.

## Debug providers

In v9 we introduced providers, which split up the providers into individual go modules. This make it more development more lightweight and speedy.
In v9 we introduced providers, which split up the providers into individual go modules. This make it more development
more lightweight and speedy.

To debug a provider locally with cnquery:

Expand All @@ -69,7 +73,42 @@ To debug a provider locally with cnquery:
make providers/config
```
3. You can now use and debug your code. For example `make cnquery/install` or start a debugger.
4. Once done, please remember to restore `providers.yaml` (or just set back: `builtin: []`) and re-run `make providers/config`.
4. Once done, please remember to restore `providers.yaml` (or just set back: `builtin: []`) and
re-run `make providers/config`.

## Using go workspaces

In case you want to develop cnquery, cnspec and providers at the same time, you can use go workspaces. This allows you
to use the latest updates from each other without having to commit and push changes.

Here is a sample config for `go.work` in the root folder of `cnquery` and `cnspec`:

```
go 1.21
use (
./cnquery
./cnquery/providers/arista
./cnquery/providers/aws
./cnquery/providers/azure
./cnquery/providers/equinix
./cnquery/providers/gcp
./cnquery/providers/github
./cnquery/providers/gitlab
./cnquery/providers/google-workspace
./cnquery/providers/ipmi
./cnquery/providers/k8s
./cnquery/providers/ms365
./cnquery/providers/oci
./cnquery/providers/okta
./cnquery/providers/opcua
./cnquery/providers/slack
./cnquery/providers/terraform
./cnquery/providers/vcd
./cnquery/providers/vsphere
./cnspec
)
```

## Contribute changes

Expand Down

0 comments on commit c953ff2

Please sign in to comment.