Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes viper dependency by removing cobra/ CLI tool #1604

Merged
merged 1 commit into from Mar 10, 2022

Conversation

jpmcb
Copy link
Collaborator

@jpmcb jpmcb commented Feb 17, 2022

In support of #1597, this PR removes the cobra CLI tool. This also removes viper and it's corresponding dependencies.

The cobra bootstrapping CLI tool has moved to: https://github.com/spf13/cobra-cli

@github-actions github-actions bot added the area/cli [deprecated] For the cobra CLI !!! moved to spf13/cobra-cli label Feb 17, 2022
README.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@marckhouzam marckhouzam left a comment

Brilliant! Thanks for doing this.

  1. Update the reference to the generator here:
    * Easy generation of applications & commands with `cobra init` & `cobra add cmdname`
  2. There is also a reference to cobra add in shell_completions.md:
    cobra add completion

    2.Remove cobra_generator from the .PHONY section of the Makefile?

    cobra/Makefile

    Line 12 in a599632

    .PHONY: fmt lint test cobra_generator install_deps clean
  3. Also (and I'm being really nit-picky), change cobra to cobra-cli in
    Use: "cobra",
  4. Maybe remove cobra_generator from
    - run: PATH=$HOME/go/bin/:$PATH make test cobra_generator
    and
    - run: PATH=$HOME/go/bin:$PATH make test cobra_generator
  5. Remove the entry from the labeler?
    "area/cli": cobra/**/*

README.md Show resolved Hide resolved
Makefile Show resolved Hide resolved
@github-actions github-actions bot added the admin For general admin tasks to be done usualy by maintainers label Feb 18, 2022
@jpmcb
Copy link
Collaborator Author

jpmcb commented Feb 18, 2022

Thanks for the quick thoughtful reviews! Updated!! 🚀

shell_completions.md Outdated Show resolved Hide resolved
shell_completions.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@marckhouzam marckhouzam left a comment

LGTM

@jpmcb jpmcb added kind/cleanup General cleanup of code, issues, etc. kind/deprecation Related to a feature or part of code being deprecated kind/documentation Documentation of cobra itself lifecycle/active Actively being worked on by a community member or maintainer. Corresponds to someone being assigned labels Feb 24, 2022
@liggitt
Copy link
Contributor

liggitt commented Mar 7, 2022

LGTM

@marckhouzam marckhouzam added the lgtm Denotes "looks good to me" from maintainers and signals other collaboratores that a PR is ready label Mar 7, 2022
@jpmcb jpmcb marked this pull request as ready for review Mar 8, 2022
The cobra bootstrapping CLI tool has moved to
https://github.com/spf13/cobra-cli

Signed-off-by: John McBride <jmcbride@vmware.com>
@jpmcb jpmcb requested a review from marckhouzam Mar 10, 2022
@github-actions github-actions bot added the area/github For changes to Github specific things not shipped in the library label Mar 10, 2022
@jpmcb jpmcb requested a review from johnSchnake Mar 10, 2022
@jpmcb jpmcb removed the lgtm Denotes "looks good to me" from maintainers and signals other collaboratores that a PR is ready label Mar 10, 2022
@jpmcb
Copy link
Collaborator Author

jpmcb commented Mar 10, 2022

Pushed a small rebase. Let's get a few quick eyes on this and then merge! 👀

@liggitt
Copy link
Contributor

liggitt commented Mar 10, 2022

lgtm

Copy link
Collaborator

@marckhouzam marckhouzam left a comment

LGTM

@marckhouzam marckhouzam added the lgtm Denotes "looks good to me" from maintainers and signals other collaboratores that a PR is ready label Mar 10, 2022
@jpmcb jpmcb merged commit 5b2b9e9 into spf13:master Mar 10, 2022
12 checks passed
@jpmcb jpmcb deleted the remove-viper branch Mar 10, 2022
@marckhouzam marckhouzam added this to the 1.4.0 milestone Mar 10, 2022
gcf-merge-on-green bot pushed a commit to googleapis/gapic-showcase that referenced this pull request Mar 10, 2022
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/spf13/cobra](https://togithub.com/spf13/cobra) | require | minor | `v1.3.0` -> `v1.4.0` |

---

### Release Notes

<details>
<summary>spf13/cobra</summary>

### [`v1.4.0`](https://togithub.com/spf13/cobra/releases/v1.4.0)

[Compare Source](https://togithub.com/spf13/cobra/compare/v1.3.0...v1.4.0)

### Winter 2022 Release ❄️

Another season, another release!

#### Goodbye viper! 🐍 🚀

The core Cobra library no longer requires Viper and all of it's indirect dependencies. This means that Cobra's dependency tree has been drastically thinned! The Viper dependency was included because of the the `cobra` CLI generation tool. [This tool has migrated to `spf13/cobra-cli`](https://togithub.com/spf13/cobra-cli/releases/tag/v1.3.0).

It's *pretty unlikely* you were importing and using **the bootstrapping CLI tool** as part of your application (after all, it's just a tool to get going with core `cobra`).

But if you were, replace occurrences of

    "github.com/spf13/cobra/cobra"

with

    "github.com/spf13/cobra-cli"

And in your `go.mod`, you'll want to also include this dependency:

    github.com/spf13/cobra-cli v1.3.0

Again, the maintainers *do not anticipate* this being a breaking change to users of the core `cobra` library, so minimal work should be required for users to integrate with this new release. Moreover, this means the dependency tree for your application using Cobra should no longer require dependencies that were inherited from Viper. Huzzah! 🥳

If you'd like to read more

-   issue: [spf13/cobra#1597
-   PR: [spf13/cobra#1604

#### Documentation 📝

-   Update Go Doc link and badge in README: [spf13/cobra#1593
-   Fix to install command, now targets `@latest`: [spf13/cobra#1576
-   Added MAINTAINERS file: [spf13/cobra#1545

#### Other 💭

-   Bumped license year to 2022 in golden files: [spf13/cobra#1575
-   Added Pixie to projects: [spf13/cobra#1581
-   Updated labeler for new labeling scheme: [spf13/cobra#1613 & syntax fix: [spf13/cobra#1624

Shoutout to our awesome contributors helping to make this cobra release possible!!
[@&#8203;spf13](https://togithub.com/spf13) [@&#8203;marckhouzam](https://togithub.com/marckhouzam) [@&#8203;johnSchnake](https://togithub.com/johnSchnake) [@&#8203;jpmcb](https://togithub.com/jpmcb) [@&#8203;liggitt](https://togithub.com/liggitt) [@&#8203;umarcor](https://togithub.com/umarcor) [@&#8203;hiljusti](https://togithub.com/hiljusti) [@&#8203;marians](https://togithub.com/marians) [@&#8203;shyim](https://togithub.com/shyim) [@&#8203;htroisi](https://togithub.com/htroisi)

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

 **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/gapic-showcase).
aviator-app bot pushed a commit to airplanedev/cli that referenced this pull request Mar 17, 2022
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/golang-jwt/jwt/v4](https://togithub.com/golang-jwt/jwt) | require | minor | `v4.3.0` -> `v4.4.0` |
| [github.com/google/uuid](https://togithub.com/google/uuid) | require | minor | `v1.2.0` -> `v1.3.0` |
| [github.com/spf13/cobra](https://togithub.com/spf13/cobra) | require | minor | `v1.3.0` -> `v1.4.0` |
| [github.com/stretchr/testify](https://togithub.com/stretchr/testify) | require | patch | `v1.7.0` -> `v1.7.1` |

---

### Release Notes

<details>
<summary>golang-jwt/jwt</summary>

### [`v4.4.0`](https://togithub.com/golang-jwt/jwt/releases/v4.4.0)

[Compare Source](https://togithub.com/golang-jwt/jwt/compare/v4.3.0...v4.4.0)

#### What's Changed

-   fix: expired token error message by [@&#8203;ydylla](https://togithub.com/ydylla) in [golang-jwt/jwt#165
-   feat: port clockskew support by [@&#8203;ksegun](https://togithub.com/ksegun) in [golang-jwt/jwt#139

#### New Contributors

-   [@&#8203;ydylla](https://togithub.com/ydylla) made their first contribution in [golang-jwt/jwt#165
-   [@&#8203;ksegun](https://togithub.com/ksegun) made their first contribution in [golang-jwt/jwt#139

**Full Changelog**: golang-jwt/jwt@v4.3.0...v4.4.0

</details>

<details>
<summary>google/uuid</summary>

### [`v1.3.0`](https://togithub.com/google/uuid/releases/v1.3.0)

[Compare Source](https://togithub.com/google/uuid/compare/v1.2.0...v1.3.0)

From Andrey Pechkurov:

Adds an optional randomness pool mode for Random (Version 4) UUID generation. The pool contains random bytes read from the random number generator on demand in batches. Enabling the pool may improve the UUID generation throughput significantly.

Since the pool is stored on the Go heap, this feature may be a bad fit for security sensitive applications. That's why it's implemented as an opt-in feature.

From Samuel Roth:

Added support for NullUUID

A NullUUID can be marked not valid (i.e., null) for use with JSON and the database/sql/driver.Scanner interfaces.

</details>

<details>
<summary>spf13/cobra</summary>

### [`v1.4.0`](https://togithub.com/spf13/cobra/releases/v1.4.0)

[Compare Source](https://togithub.com/spf13/cobra/compare/v1.3.0...v1.4.0)

### Winter 2022 Release ❄️

Another season, another release!

#### Goodbye viper! 🐍 🚀

The core Cobra library no longer requires Viper and all of its indirect dependencies. This means that Cobra's dependency tree has been drastically thinned! The Viper dependency was included because of the `cobra` CLI generation tool. [This tool has migrated to `spf13/cobra-cli`](https://togithub.com/spf13/cobra-cli/releases/tag/v1.3.0).

It's *pretty unlikely* you were importing and using **the bootstrapping CLI tool** as part of your application (after all, it's just a tool to get going with core `cobra`).

But if you were, replace occurrences of

    "github.com/spf13/cobra/cobra"

with

    "github.com/spf13/cobra-cli"

And in your `go.mod`, you'll want to also include this dependency:

    github.com/spf13/cobra-cli v1.3.0

Again, the maintainers *do not anticipate* this being a breaking change to users of the core `cobra` library, so minimal work should be required for users to integrate with this new release. Moreover, this means the dependency tree for your application using Cobra should no longer require dependencies that were inherited from Viper. Huzzah! 🥳

If you'd like to read more

-   issue: [spf13/cobra#1597
-   PR: [spf13/cobra#1604

#### Documentation 📝

-   Update Go Doc link and badge in README: [spf13/cobra#1593
-   Fix to install command, now targets `@latest`: [spf13/cobra#1576
-   Added MAINTAINERS file: [spf13/cobra#1545

#### Other 💭

-   Bumped license year to 2022 in golden files: [spf13/cobra#1575
-   Added Pixie to projects: [spf13/cobra#1581
-   Updated labeler for new labeling scheme: [spf13/cobra#1613 & syntax fix: [spf13/cobra#1624

Shoutout to our awesome contributors helping to make this cobra release possible!!
[@&#8203;spf13](https://togithub.com/spf13) [@&#8203;marckhouzam](https://togithub.com/marckhouzam) [@&#8203;johnSchnake](https://togithub.com/johnSchnake) [@&#8203;jpmcb](https://togithub.com/jpmcb) [@&#8203;liggitt](https://togithub.com/liggitt) [@&#8203;umarcor](https://togithub.com/umarcor) [@&#8203;hiljusti](https://togithub.com/hiljusti) [@&#8203;marians](https://togithub.com/marians) [@&#8203;shyim](https://togithub.com/shyim) [@&#8203;htroisi](https://togithub.com/htroisi)

</details>

<details>
<summary>stretchr/testify</summary>

### [`v1.7.1`](https://togithub.com/stretchr/testify/compare/v1.7.0...v1.7.1)

[Compare Source](https://togithub.com/stretchr/testify/compare/v1.7.0...v1.7.1)

</details>

---

### Configuration

📅 **Schedule**: "before 5am on Thursday" in timezone America/New_York.

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

 **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.
PatMyron added a commit to PatMyron/cobra.dev that referenced this pull request Apr 2, 2022
@renovate renovate bot mentioned this pull request Apr 8, 2022
1 task
gcf-merge-on-green bot pushed a commit to GoogleCloudPlatform/alloydb-auth-proxy that referenced this pull request May 18, 2022
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/spf13/cobra](https://togithub.com/spf13/cobra) | require | minor | `v1.2.1` -> `v1.4.0` |

---

### Release Notes

<details>
<summary>spf13/cobra</summary>

### [`v1.4.0`](https://togithub.com/spf13/cobra/releases/v1.4.0)

[Compare Source](https://togithub.com/spf13/cobra/compare/v1.3.0...v1.4.0)

### Winter 2022 Release ❄️

Another season, another release!

#### Goodbye viper! 🐍 🚀

The core Cobra library no longer requires Viper and all of its indirect dependencies. This means that Cobra's dependency tree has been drastically thinned! The Viper dependency was included because of the `cobra` CLI generation tool. [This tool has migrated to `spf13/cobra-cli`](https://togithub.com/spf13/cobra-cli/releases/tag/v1.3.0).

It's *pretty unlikely* you were importing and using **the bootstrapping CLI tool** as part of your application (after all, it's just a tool to get going with core `cobra`).

But if you were, replace occurrences of

    "github.com/spf13/cobra/cobra"

with

    "github.com/spf13/cobra-cli"

And in your `go.mod`, you'll want to also include this dependency:

    github.com/spf13/cobra-cli v1.3.0

Again, the maintainers *do not anticipate* this being a breaking change to users of the core `cobra` library, so minimal work should be required for users to integrate with this new release. Moreover, this means the dependency tree for your application using Cobra should no longer require dependencies that were inherited from Viper. Huzzah! 🥳

If you'd like to read more

-   issue: [spf13/cobra#1597
-   PR: [spf13/cobra#1604

#### Documentation 📝

-   Update Go Doc link and badge in README: [spf13/cobra#1593
-   Fix to install command, now targets `@latest`: [spf13/cobra#1576
-   Added MAINTAINERS file: [spf13/cobra#1545

#### Other 💭

-   Bumped license year to 2022 in golden files: [spf13/cobra#1575
-   Added Pixie to projects: [spf13/cobra#1581
-   Updated labeler for new labeling scheme: [spf13/cobra#1613 & syntax fix: [spf13/cobra#1624

Shoutout to our awesome contributors helping to make this cobra release possible!!
[@&#8203;spf13](https://togithub.com/spf13) [@&#8203;marckhouzam](https://togithub.com/marckhouzam) [@&#8203;johnSchnake](https://togithub.com/johnSchnake) [@&#8203;jpmcb](https://togithub.com/jpmcb) [@&#8203;liggitt](https://togithub.com/liggitt) [@&#8203;umarcor](https://togithub.com/umarcor) [@&#8203;hiljusti](https://togithub.com/hiljusti) [@&#8203;marians](https://togithub.com/marians) [@&#8203;shyim](https://togithub.com/shyim) [@&#8203;htroisi](https://togithub.com/htroisi)

### [`v1.3.0`](https://togithub.com/spf13/cobra/releases/v1.3.0)

[Compare Source](https://togithub.com/spf13/cobra/compare/v1.2.1...v1.3.0)

### v1.3.0 - The Fall 2021 release 🍁

#### Completion fixes & enhancements 💇🏼

In `v1.2.0`, we introduced a new model for completions. Thanks to everyone for trying it, giving feedback, and providing numerous fixes! Continue to work with the new model as the old one (as noted in code comments) will be deprecated in a coming release.

-   `DisableFlagParsing` now triggers custom completions for flag names [#&#8203;1161](https://togithub.com/spf13/cobra/issues/1161)
-   Fixed unbound variables in bash completions causing edge case errors [#&#8203;1321](https://togithub.com/spf13/cobra/issues/1321)
-   `help` completion formatting improvements & fixes [#&#8203;1444](https://togithub.com/spf13/cobra/issues/1444)
-   All completions now follow the `help` example: short desc are now capitalized and removes extra spacing from long description [#&#8203;1455](https://togithub.com/spf13/cobra/issues/1455)
-   Typo fixes in bash & zsh completions [#&#8203;1459](https://togithub.com/spf13/cobra/issues/1459)
-   Fixed mixed tab/spaces indentation in completion scripts. Now just 4 spaces [#&#8203;1473](https://togithub.com/spf13/cobra/issues/1473)
-   Support for different bash completion options. Bash completions v2 supports descriptions and requires descriptions to be removed for `menu-complete`, `menu-complete-backward` and `insert-completions`. These descriptions are now purposefully removed in support of this model. [#&#8203;1509](https://togithub.com/spf13/cobra/issues/1509)
-   Fix for invalid shell completions when using `~/.cobra.yaml`. Log message `Using config file: ~/.cobra.yaml` now printed to stderr [#&#8203;1510](https://togithub.com/spf13/cobra/issues/1510)
-   Removes unnecessary trailing spaces from completion command descriptions [#&#8203;1520](https://togithub.com/spf13/cobra/issues/1520)
-   Option to hide default `completion` command [#&#8203;1541](https://togithub.com/spf13/cobra/issues/1541)
-   Remove `__complete` command for programs without subcommands [#&#8203;1563](https://togithub.com/spf13/cobra/issues/1563)

#### Generator changes ⚙️

Thanks to [@&#8203;spf13](https://togithub.com/spf13) for providing a number of changes to the Cobra generator tool, streamlining it for new users!

-   The Cobra generator now *won't* automatically include Viper and cleans up a number of unused imports when not using Viper.
-   The Cobra generator's default license is now `none`
-   The Cobra generator now works with Go modules
-   Documentation to reflect these changes

#### New Features 

-   License can be specified by their SPDX identifiers [#&#8203;1159](https://togithub.com/spf13/cobra/issues/1159)
-   `MatchAll` allows combining several PositionalArgs to work in concert. This now allows for enabling composing `PositionalArgs` [#&#8203;896](https://togithub.com/spf13/cobra/issues/896)

#### Bug Fixes 🐛

-   Fixed multiple error message from cobra `init` boilerplates [#&#8203;1463](https://togithub.com/spf13/cobra/issues/1463) [#&#8203;1552](https://togithub.com/spf13/cobra/issues/1552) [#&#8203;1557](https://togithub.com/spf13/cobra/issues/1557)

#### Testing 👀

-   Now testing golang 1.16.x and 1.17.x in CI [#&#8203;1425](https://togithub.com/spf13/cobra/issues/1425)
-   Fix for running diff test to ignore CR for windows [#&#8203;949](https://togithub.com/spf13/cobra/issues/949)
-   Added helper functions and reduced code reproduction in `args_test` [#&#8203;1426](https://togithub.com/spf13/cobra/issues/1426)
-   Now using official `golangci-lint` github action [#&#8203;1477](https://togithub.com/spf13/cobra/issues/1477)

#### Security 🔏

-   Added GitHub dependabot [#&#8203;1427](https://togithub.com/spf13/cobra/issues/1427)
-   Now using Viper `v1.10.0`
    -   There is a known CVE in an *indirect* dependency from `viper`: [spf13/cobra#1538. This will be patched in a future release

#### Documentation 📝

-   Multiple projects added to the `projects_using_cobra.md` file: [#&#8203;1377](https://togithub.com/spf13/cobra/issues/1377) [#&#8203;1501](https://togithub.com/spf13/cobra/issues/1501) [#&#8203;1454](https://togithub.com/spf13/cobra/issues/1454)
-   Removed ToC from main readme file as it is now automagically displayed by GitHub [#&#8203;1429](https://togithub.com/spf13/cobra/issues/1429)
-   Documentation correct for when the `--author` flag is specified [#&#8203;1009](https://togithub.com/spf13/cobra/issues/1009)
-   `shell_completions.md` has an easier to use snippet for copying and pasting shell completions [#&#8203;1372](https://togithub.com/spf13/cobra/issues/1372)

#### Other 💭

-   Bump version of  `cpuguy83/go-md2man` to v2.0.1 [#&#8203;1460](https://togithub.com/spf13/cobra/issues/1460)
-   Removed `lesser` typo from the GPL-2.0 license [#&#8203;880](https://togithub.com/spf13/cobra/issues/880)
-   Fixed spelling errors [#&#8203;1514](https://togithub.com/spf13/cobra/issues/1514)

*Thank you to all our amazing contributors* 🐍🚀

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

 **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/GoogleCloudPlatform/alloydb-auth-proxy).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
admin For general admin tasks to be done usualy by maintainers area/cli [deprecated] For the cobra CLI !!! moved to spf13/cobra-cli area/github For changes to Github specific things not shipped in the library kind/cleanup General cleanup of code, issues, etc. kind/deprecation Related to a feature or part of code being deprecated kind/documentation Documentation of cobra itself lgtm Denotes "looks good to me" from maintainers and signals other collaboratores that a PR is ready lifecycle/active Actively being worked on by a community member or maintainer. Corresponds to someone being assigned
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants