-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📝 add documentation for go workspaces (#1758)
- Loading branch information
1 parent
b03fcb7
commit c953ff2
Showing
1 changed file
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
||
|
@@ -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 | ||
|
||
|