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

Use separate names for examples named basic #2356

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bantonsson
Copy link
Contributor

Changes

Renames two examples both named basic.rs, since building and running the examples will give you warnings (and not even work) because there are two example targets named basic.

Running cargo build --examples gives this:

warning: output filename collision.
The example target `basic` in package `opentelemetry-stdout v0.27.0 (/.../opentelemetry-rust/opentelemetry-stdout)` has the same output filename as the example target `basic` in package `opentelemetry-appender-tracing v0.27.0 (/.../opentelemetry-rust/opentelemetry-appender-tracing)`.
Colliding filename is: /.../opentelemetry-rust/target/debug/examples/basic
The targets should have unique names.
Consider changing their names to be unique or compiling them separately.
This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.

And running cargo run --example basic fails with:

error: `cargo run` can run at most one executable, but multiple were specified

(

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@bantonsson bantonsson requested a review from a team as a code owner November 27, 2024 08:02
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.5%. Comparing base (e0159ad) to head (4863a0e).

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #2356     +/-   ##
=======================================
- Coverage   79.5%   79.5%   -0.1%     
=======================================
  Files        123     123             
  Lines      21492   21492             
=======================================
- Hits       17094   17090      -4     
- Misses      4398    4402      +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lalitb
Copy link
Member

lalitb commented Nov 27, 2024

Thanks can we also modify the comments e.g,-

//! run with `$ cargo run --example basic

@cijothomas
Copy link
Member

I am neutral to this...The issue linked is open from 2018.

When inside the directory, running cargo run --example basic is easy to remember than cargo run --example stdout-basic

Happy to hear other thoughts on this..

@lalitb
Copy link
Member

lalitb commented Nov 27, 2024

I am also neutral about this, as it is still possible to run the specific basic.rs from workspace root:

$ cargo run -p opentelemetry-stdout --example basic
$ cargo run -p opentelemetry-appender-tracing --example basic

@bantonsson
Copy link
Contributor Author

This is not a big thing. I just thought that the name collisions were a bad thing based on the warning and behavior, and there was already a precedent with the logs-basic example not being named basic.

For me, my shell will tab complete the existing example names when I write cargo run --example <TAB>, so remembering the name is not much of an issue.

I'll update the comments if you think the name change is ok, otherwise just close this PR.

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.

3 participants