How to create a container
Walk
登录后可跨设备保存划线和私人笔记登录
Walk
Walk walks the strategies tree and calls the visit function for each node.
This allows modules to easily amend default wait strategies, updating or removing specific strategies based on requirements of functional options.
For example removing a TLS strategy if a functional option enabled insecure mode or changing the location of the certificate based on the configured user.
If visit function returns wait.ErrVisitStop, the walk stops. If visit function returns wait.ErrVisitRemove, the current node is removed.
Walk removing entries
The following example shows how to remove a strategy based on its type.
Remove FileStrategy entries
var count, matched int
err := wait.Walk(&req.WaitingFor, func(s wait.Strategy) error {
count++
if _, ok := s.(*wait.FileStrategy); ok {
matched++
return wait.ErrVisitRemove
}
return nil
})评论
登录后参与评论
正在加载评论…
KnowForge