improve: reset libgo.h atime/mtime to use rust side cache#90
Conversation
There was a problem hiding this comment.
Pull Request Overview
Adds support for resetting the generated Go header’s access and modification times to speed up rebuilds, exposes a new multi_param_test binding on the Go side, bumps the crate version, and renames example binaries for clarity.
- Introduce
multi_param_teston the Go interface and itsCTestCallexport - Update
build.rsto read and restore header file timestamps around the Go build step - Bump
rust2goto v0.4.2, addfs-set-timesdependency, and rename example binary targets
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/go/gen.go | Add multi_param_test to TestCall and implement its CTestCall export function |
| rust2go/src/build.rs | Rename filename→lib_filename, add header_filename and read_header_file, and restore .h atime/mtime |
| rust2go/Cargo.toml | Bump version to 0.4.2, add optional fs-set-times dependency, include it in build feature |
| examples/*/Cargo.toml | Rename example binaries (e.g., example→example-tokio-cgo, etc.) |
Comments suppressed due to low confidence (4)
test/go/gen.go:153
- [nitpick] Variable name
_new_useris unconventional in Go—consider renaming touserValoruserArgto follow Go naming conventions and improve readability.
_new_user := newUser(user)
rust2go/src/build.rs:357
LIB_EXTis not defined or imported here, leading to a compilation error. Define or import the correct constant (e.g.,".a") or replace with the appropriate static-library suffix.
LinkType::Static => format!("{DLL_PREFIX}go{LIB_EXT}"),
test/go/gen.go:151
- No tests are added to cover the new
multi_param_testexport path—consider adding a Go-side or integration test to ensure this path is exercised and prevent regressions.
//export CTestCall_multi_param_test
rust2go/src/build.rs:370
- [nitpick] Helper
read_header_filewould benefit from a doc comment explaining its return tuple (header bytes and optional access/modify times) to improve maintainability.
fn read_header_file(
|
@zhongxinghong Could you have a look at if this branch work? Thank you |
|
Hi~ I've tested the rust2go regen the fn main() {
rust2go::Builder::new()
.with_go_src("../wrapper")
.with_regen_arg(RegenArgs {
src: "./src/idl.rs".into(),
dst: "../wrapper/gen.go".into(),
go118: true,
..Default::default()
})
.build();
}My solution on the issue is to reset the times of |
Fixes #83