Skip to content

Commit

Permalink
Merge pull request #2813 from lengrongfu/fix/move-youki_version
Browse files Browse the repository at this point in the history
RustRover fix: macro define youki_version to use before
  • Loading branch information
YJDoc2 authored Jun 14, 2024
2 parents 4d4ce7c + bdf8db4 commit b6d210e
Showing 1 changed file with 18 additions and 18 deletions.
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

0 comments on commit b6d210e

Please sign in to comment.