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

Add buf config ls-modules #3081

Merged
merged 6 commits into from
Jun 21, 2024
Merged

Add buf config ls-modules #3081

merged 6 commits into from
Jun 21, 2024

Conversation

bufdev
Copy link
Member

@bufdev bufdev commented Jun 13, 2024

Fixes #3035.

bufdev and others added 2 commits June 13, 2024 18:54
This PR
* adds test for `buf config ls-modules`
* update the command to error when both `./buf.yaml` and
`./buf.work.yaml` exist

---------

Co-authored-by: bufdev <bufdev-github@buf.build>
@bufdev bufdev changed the title WIP: Add buf config ls-modules Add buf config ls-modules Jun 19, 2024
@bufdev
Copy link
Member Author

bufdev commented Jun 20, 2024

@doriable will assume you will review my initial code and handle taking on any other necessary changes, I can't approve my own PR.

Copy link
Member

@pkwarren pkwarren left a comment

Choose a reason for hiding this comment

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

Change looks good to me.

}
}()

require.NoError(t, osext.Chdir(filepath.Join(pwd, "testdata", "lsmodules", "workspacev1")))
Copy link
Member

Choose a reason for hiding this comment

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

It could be handy if buf config ls-modules accepted an optional arg <dir> so you could use it without relying on chdir.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think --config does that, except it doesn't accept a buf.work.yaml

private/buf/cmd/buf/buf_test.go Outdated Show resolved Hide resolved
private/buf/cmd/buf/buf_test.go Outdated Show resolved Hide resolved
private/buf/cmd/buf/buf_test.go Outdated Show resolved Hide resolved
&f.Config,
configFlagName,
"",
`The buf.yaml file or data to use for configuration.`,
Copy link
Member

Choose a reason for hiding this comment

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

The implementation first looks for a buf.work.yaml file then falls back to a buf.yaml file. Do we want the --config argument to accept either a buf.yaml or a buf.work.yaml file?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that's a good point:

  • by default, the command looks for ./buf.work.yaml or ./buf.yaml
  • but the --config currently only accepts buf.yaml

It does feel a bit inconsistent. Do you have thoughts on this? @bufdev @doriable @emcfarlane

@oliversun9 oliversun9 requested a review from pkwarren June 21, 2024 19:18
@oliversun9 oliversun9 merged commit 52a4214 into main Jun 21, 2024
9 checks passed
@oliversun9 oliversun9 deleted the config-ls-modules branch June 21, 2024 19:23
emcfarlane added a commit to bufbuild/buf-action that referenced this pull request Jul 3, 2024
Update the module name parsing to use `buf ls-modules` now we have `buf`
at v1.34.0 as a requirement. This also fixes an issue for root named
modules, which missed a call to `parseModules` causing the module to
fail. Added a test to cover the root name case.

See bufbuild/buf#3081
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.

Feature request: buf config ls-modules
3 participants