diff --git a/docs/development.md b/docs/development.md index 01f1ad19f2..7ec093424e 100644 --- a/docs/development.md +++ b/docs/development.md @@ -19,7 +19,8 @@ On macOS systems with Homebrew, run: `brew install go@1.21 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: @@ -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 @@ -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: @@ -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