Skip to content

Conversation

@ttys3
Copy link

@ttys3 ttys3 commented Jul 29, 2022

Motivation

currently we have github.com/spf13/cobra v1.2 dependency, which depends on spf13/viper (which is a heavy mod)

the good news is that github.com/spf13/cobra version >= v1.4.0 has viper mod dependency removed.

yes, but we can still avoid introduce unnecessary dependency to SDK client users.

Modifications

make the pulsar-perf binary a standalone mod, so that its cobra dependency does not affect pulsar-client-go

nothing is break, but a more clean go mod

Verifying this change

  • Make sure that the change passes the CI checks.

This change is a trivial rework / code cleanup without any test coverage.

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (yes)

Dependencies removed from module github.com/apache/pulsar-client-go:

github.com/bmizerany/perks v0.0.0-20141205001514-d9a9656a3a4b

github.com/spf13/cobra v1.2.1

new module github.com/apache/pulsar-client-go/pulsar-perf introduced (which is not a package, but binary only package)

old github.com/spf13/cobra v1.2.1 updated to github.com/spf13/cobra v1.5.0 since this version has github.com/spf13/viper removed (which does not affect the feature of cobra, see https://github.com/spf13/cobra/releases/tag/v1.4.0 )

	github.com/apache/pulsar-client-go v0.8.1
	github.com/bmizerany/perks v0.0.0-20141205001514-d9a9656a3a4b
	github.com/prometheus/client_golang v1.12.2
	github.com/sirupsen/logrus v1.9.0
	github.com/spf13/cobra v1.5.0
  • The public API: (no)
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)

Documentation

  • Does this pull request introduce a new feature? (no)

Copy link
Contributor

@zzzming zzzming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is helpful to remove unnecessary dependency if we upgrade spf13/cobra.

LGTM.

@ttys3 can you rebase the PR?

@ttys3 ttys3 force-pushed the reduce-dependency branch from 32c4375 to faad803 Compare October 11, 2022 02:03
@ttys3 ttys3 requested a review from zzzming October 11, 2022 02:05
@ttys3
Copy link
Author

ttys3 commented Oct 11, 2022

@zzzming rebased, PTAL

@ttys3 ttys3 requested review from hezhangjian and zzzming and removed request for hezhangjian and zzzming October 21, 2022 14:57
Copy link
Contributor

@pgier pgier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to upgrading the cobra dependency
However, I'm not sure if it's a good idea to split pulsar-perf-go to a separate module. In general it's recommended to have a single go module per git repo. Although I understand the advantage in this case because users of the client library should normally never depend on the specific pulsar-perf code.

It might be better to have two separate PRs, one for the cobra upgrade, and a separate one for the pulsar-perf split.

@ttys3
Copy link
Author

ttys3 commented Sep 9, 2024

+1 to upgrading the cobra dependency However, I'm not sure if it's a good idea to split pulsar-perf-go to a separate module. In general it's recommended to have a single go module per git repo. Although I understand the advantage in this case because users of the client library should normally never depend on the specific pulsar-perf code.

It might be better to have two separate PRs, one for the cobra upgrade, and a separate one for the pulsar-perf split.

now that main branch has https://github.com/apache/pulsar-client-go/blob/be553141c52d5088981452ea5444aa62135b52d3/go.mod#L22C2-L22C31

so no need update cobra anymore.

I you are OK to merge, I can continue to work on the pulsar-perf split

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants