Skip to content

Commit 3d67aae

Browse files
committed
condense the go feature block
1 parent c3596bb commit 3d67aae

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

cli/src/main.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,11 @@ fn override_configuration(mut config: Config, options: &Args) -> anyhow::Result<
257257
config.go.package = go_package.to_string();
258258
}
259259

260-
if let Some(args::AvailableLanguage::Go) = options.language {
261-
assert_go_package_present(&config)?;
260+
if matches!(options.language, Some(args::AvailableLanguage::Go)) {
261+
anyhow::ensure!(
262+
!config.go.package.is_empty(),
263+
"Please provide a package name in the typeshare.toml or using --go-package <package name>"
264+
);
262265
}
263266
}
264267

@@ -290,13 +293,3 @@ fn check_parse_errors(parsed_crates: &BTreeMap<CrateName, ParsedData>) -> anyhow
290293
Ok(())
291294
}
292295
}
293-
294-
#[cfg(feature = "go")]
295-
fn assert_go_package_present(config: &Config) -> anyhow::Result<()> {
296-
if config.go.package.is_empty() {
297-
return Err(anyhow!(
298-
"Please provide a package name in the typeshare.toml or using --go-package <package name>"
299-
));
300-
}
301-
Ok(())
302-
}

0 commit comments

Comments
 (0)