Skip to content

Commit 277fda3

Browse files
authored
cleanup golang typegen (#73)
1 parent ae272ff commit 277fda3

File tree

1 file changed

+6
-34
lines changed
  • ahnlich/typegen/src/tracers

1 file changed

+6
-34
lines changed

ahnlich/typegen/src/tracers/mod.rs

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -146,40 +146,12 @@ impl<'a> OutputFile<'a> {
146146
}
147147
Language::Golang => {
148148
// All packages are already published
149-
150-
let output_dir = output_dir.join("internal");
151-
152-
let (output_dir, config) = match self.output_file {
153-
"db_response" => {
154-
let config = serde_generate::CodeGeneratorConfig::new(
155-
"internal_db_response".to_string(),
156-
)
157-
.with_encodings(vec![serde_generate::Encoding::Bincode]);
158-
(output_dir.join("db_response"), config)
159-
}
160-
"db_query" => {
161-
let config = serde_generate::CodeGeneratorConfig::new(
162-
"internal_db_query".to_string(),
163-
)
164-
.with_encodings(vec![serde_generate::Encoding::Bincode]);
165-
(output_dir.join("db_query"), config)
166-
}
167-
"ai_response" => {
168-
let config = serde_generate::CodeGeneratorConfig::new(
169-
"internal_ai_response".to_string(),
170-
)
171-
.with_encodings(vec![serde_generate::Encoding::Bincode]);
172-
(output_dir.join("ai_response"), config)
173-
}
174-
"ai_query" => {
175-
let config = serde_generate::CodeGeneratorConfig::new(
176-
"internal_ai_query".to_string(),
177-
)
178-
.with_encodings(vec![serde_generate::Encoding::Bincode]);
179-
(output_dir.join("ai_query"), config)
180-
}
181-
_ => panic!("Incorrect query type"),
182-
};
149+
let output_dir = output_dir.join("internal").join(self.output_file);
150+
let config = serde_generate::CodeGeneratorConfig::new(format!(
151+
"internal_{}",
152+
self.output_file
153+
))
154+
.with_encodings(vec![serde_generate::Encoding::Bincode]);
183155
// create all and ignore the errors if they exists
184156
let _ = std::fs::create_dir_all(&output_dir);
185157

0 commit comments

Comments
 (0)