...

Text file src/sigs.k8s.io/cli-utils/CONTRIBUTING.md

Documentation: sigs.k8s.io/cli-utils

     1# Contributing Guidelines
     2
     3Welcome to Kubernetes. We are excited about the prospect of you joining our [community](https://git.k8s.io/community)! The Kubernetes community abides by the CNCF [code of conduct](code-of-conduct.md). Here is an excerpt:
     4
     5_As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities._
     6
     7## Getting Started
     8
     9We have full documentation on how to get started contributing here:
    10
    11<!---
    12If your repo has certain guidelines for contribution, put them here ahead of the general k8s resources
    13-->
    14
    15- [Contributor License Agreement](https://git.k8s.io/community/CLA.md) Kubernetes projects require that you sign a Contributor License Agreement (CLA) before we can accept your pull requests
    16- [Kubernetes Contributor Guide](https://git.k8s.io/community/contributors/guide) - Main contributor documentation, or you can just jump directly to the [contributing section](https://git.k8s.io/community/contributors/guide#contributing)
    17- [Contributor Cheat Sheet](https://git.k8s.io/community/contributors/guide/contributor-cheatsheet/README.md) - Common resources for existing developers
    18
    19## Mentorship
    20
    21- [Mentoring Initiatives](https://git.k8s.io/community/mentoring) - We have a diverse set of mentorship programs available that are always looking for volunteers!
    22
    23## Contact Information
    24
    25- [Slack channel](https://kubernetes.slack.com/messages/sig-cli)
    26- [Mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-cli)
    27
    28## Setup a Dev Environment
    29
    30- install [go](https://golang.org/doc/install)
    31- `export GO111MODULE=on`
    32- install [wire](https://github.com/google/wire/)
    33
    34## Build and Test
    35
    361. `go generate`
    37  - Generates the `wire_gen.go` files
    381. `go test ./...`
    39  - Test the
    401. `golint -min_confidence 0.9 ./...`
    41  - Look for errors
    421. `go build`
    43  - Build the binary
    44
    45## Dependency Injection
    46
    47This repo uses Dependency Injection for wiring together the Commands.  See the
    48[wire tutorial](https://github.com/google/wire/tree/master/_tutorial) for more on DI.
    49
    50## Adding a Command
    51
    521. Add a new package for your cobra command under `cmd/`
    53  - e.g. `kubectl apply status` would be added under `cmd/apply/status`
    54  - Add it to the parent command
    55  - Copy an existing command as an example
    561. Add a new package that contains the library for your command under `internal/pkg`
    57  - e.g. `kubectl apply status` library would be added under `internal/pkg/status`
    58  - Invoke it from the command you added
    59  - Copy an existing package as an example
    601. Add the DI wiring for your library
    61  - Edit `internal/pkg/wiring/wiring.go` - Add your struct to the `ProviderSet` list
    62  - Edit `internal/pkg/wiring/wire.go` - Add an `Initialize` function for you struct
    63
    64## Adding a Library (non-internal)
    65
    661. Add a new package for your library under `pkg`
    671. Add a new package that contains the implementation under `internal/pkg`
    68  - Invoke it from your public package

View as plain text