我想自动化一些测试,在这些测试中我必须操纵系统时间来检查用 golang 编写的程序的身份验证行为。根据this post , libfaketime 不适用于 golang。有没有另一种方法可以实现我想用 libfaketime 做的事情?
这是来自 github 的 libfaketime 功能的描述。
libfaketime intercepts various system calls that programs use to retrieve the current date and time. It then reports modified (faked) dates and times (as specified by you, the user) to these programs. This means you can modify the system time a program sees without having to change the time system-wide.
最佳答案
关于testing - Golang 有 libfaketime 替代品吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48173379/