Skip to content
New issue

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

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

Already on GitHub? # to your account

move macro define youki_version to use before #2813

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions crates/youki/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@ struct YoukiExtendOpts {
pub log_level: Option<String>,
}

/// output Youki version in Moby compatible format
#[macro_export]
macro_rules! youki_version {
// For compatibility with Moby, match format here:
// https://github.com/moby/moby/blob/65cc84abc522a564699bb171ca54ea1857256d10/daemon/info_unix.go#L280
() => {
concat!(
"version ",
crate_version!(),
"\ncommit: ",
crate_version!(),
"-0-",
env!("VERGEN_GIT_SHA")
)
};
}

// High-level commandline option definition
// This takes global options as well as individual commands as specified in [OCI runtime-spec](https://github.com/opencontainers/runtime-spec/blob/master/runtime.md)
// Also check [runc commandline documentation](https://github.com/opencontainers/runc/blob/master/man/runc.8.md) for more explanation
Expand Down Expand Up @@ -54,23 +71,6 @@ enum SubCommand {
Completion(commands::completion::Completion),
}

/// output Youki version in Moby compatible format
#[macro_export]
macro_rules! youki_version {
// For compatibility with Moby, match format here:
// https://github.com/moby/moby/blob/65cc84abc522a564699bb171ca54ea1857256d10/daemon/info_unix.go#L280
() => {
concat!(
"version ",
crate_version!(),
"\ncommit: ",
crate_version!(),
"-0-",
env!("VERGEN_GIT_SHA")
)
};
}

/// This is the entry point in the container runtime. The binary is run by a high-level container runtime,
/// with various flags passed. This parses the flags, creates and manages appropriate resources.
fn main() -> Result<()> {
Expand All @@ -89,7 +89,7 @@ fn main() -> Result<()> {
let opts = Opts::parse();
let mut app = Opts::command();

crate::observability::init(&opts).map_err(|err| {
observability::init(&opts).map_err(|err| {
eprintln!("failed to initialize observability: {}", err);
err
})?;
Expand Down
Loading