func(ctx context.Context, lowerBoundBlk uint64, targetTime uint64) (*types.HeaderInfo, error) could be replaced with func(ctx context.Context, lowerBoundBlk, targetTime uint64) (*types.HeaderInfo, error)
181
182// Performs a search to find a target eth1 block which is just earlier than or equal to the
183// target time. This method is used when head.time < targetTime
184func (s *Service) findMinTargetEth1Block(ctx context.Context, lowerBoundBlk uint64, targetTime uint64) (*types.HeaderInfo, error) {185 for bn := lowerBoundBlk; ; bn++ {
186 if ctx.Err() != nil {
187 return nil, ctx.Err()
func(ctx context.Context, upperBoundBlk uint64, targetTime uint64) (*types.HeaderInfo, error) could be replaced with func(ctx context.Context, upperBoundBlk, targetTime uint64) (*types.HeaderInfo, error)
164
165// Performs a search to find a target eth1 block which is earlier than or equal to the
166// target time. This method is used when head.time > targetTime
167func (s *Service) findMaxTargetEth1Block(ctx context.Context, upperBoundBlk uint64, targetTime uint64) (*types.HeaderInfo, error) {168 for bn := upperBoundBlk; ; bn-- {
169 if ctx.Err() != nil {
170 return nil, ctx.Err()
Description
If parameters of the same type lie consecutively, mention their type once at the end of the last parameter.
Unlike other languages, like C, where all parameters must be specified with types explicitly, it is not required to do so in Go. Combining the types is usually recommended for the sake of brevity.
Bad practice
func foo(a, b int, c, d int, e, f int, g int) {}
Recommended
func foo(a, b, c, d, e, f, g int) {}