mirror of https://github.com/fluxcd/cli-utils.git
update CONTRIBUTING.md
This commit is contained in:
parent
bb2e42fc06
commit
e905a96e42
|
@ -24,3 +24,45 @@ If your repo has certain guidelines for contribution, put them here ahead of the
|
||||||
|
|
||||||
- [Slack channel](https://kubernetes.slack.com/messages/sig-cli)
|
- [Slack channel](https://kubernetes.slack.com/messages/sig-cli)
|
||||||
- [Mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-cli)
|
- [Mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-cli)
|
||||||
|
|
||||||
|
## Setup a Dev Environment
|
||||||
|
|
||||||
|
- install [go](https://golang.org/doc/install)
|
||||||
|
- `export GO111MODULE=on`
|
||||||
|
- install [wire](https://github.com/google/wire/)
|
||||||
|
|
||||||
|
## Build and Test
|
||||||
|
|
||||||
|
1. `go generate`
|
||||||
|
- Generates the `wire_gen.go` files
|
||||||
|
1. `go test ./...`
|
||||||
|
- Test the
|
||||||
|
1. `golint -min_confidence 0.9 ./...`
|
||||||
|
- Look for errors
|
||||||
|
1. `go build`
|
||||||
|
- Build the binary
|
||||||
|
|
||||||
|
## Dependency Injection
|
||||||
|
|
||||||
|
This repo uses Dependency Injection for wiring together the Commands. See the
|
||||||
|
[wire tutorial](https://github.com/google/wire/tree/master/_tutorial) for more on DI.
|
||||||
|
|
||||||
|
## Adding a Command
|
||||||
|
|
||||||
|
1. Add a new package for your cobra command under `cmd/`
|
||||||
|
- e.g. `kubectl apply status` would be added under `cmd/apply/status`
|
||||||
|
- Add it to the parent command
|
||||||
|
- Copy an existing command as an example
|
||||||
|
1. Add a new package that contains the library for your command under `internal/pkg`
|
||||||
|
- e.g. `kubectl apply status` library would be added under `internal/pkg/status`
|
||||||
|
- Invoke it from the command you added
|
||||||
|
- Copy an existing package as an example
|
||||||
|
1. Add the DI wiring for your library
|
||||||
|
- Edit `internal/pkg/wiring/wiring.go` - Add your struct to the `ProviderSet` list
|
||||||
|
- Edit `internal/pkg/wiring/wire.go` - Add an `Initialize` function for you struct
|
||||||
|
|
||||||
|
## Adding a Library (non-internal)
|
||||||
|
|
||||||
|
1. Add a new package for your library under `pkg`
|
||||||
|
1. Add a new package that contains the implementation under `internal/pkg`
|
||||||
|
- Invoke it from your public package
|
||||||
|
|
Loading…
Reference in New Issue