mirror of
				https://github.com/onyx-and-iris/aoc2024.git
				synced 2025-11-04 06:51:47 +00:00 
			
		
		
		
	remove unnecessary assignments
This commit is contained in:
		
							parent
							
								
									fd057f88ed
								
							
						
					
					
						commit
						2b675af081
					
				@ -19,18 +19,14 @@ func Solve(buf []byte) (int, error) {
 | 
			
		||||
	for _, equation := range equations {
 | 
			
		||||
		go func() {
 | 
			
		||||
			var total int
 | 
			
		||||
			if res, ok := next(equation.target, equation.operands, total, sumOp); ok {
 | 
			
		||||
			res, _ := next(equation.target, equation.operands, total, sumOp)
 | 
			
		||||
			sumChan <- res
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
			sumChan <- 0
 | 
			
		||||
		}()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var sum int
 | 
			
		||||
	for range conc {
 | 
			
		||||
		res := <-sumChan
 | 
			
		||||
		sum += res
 | 
			
		||||
		sum += <-sumChan
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return sum, nil
 | 
			
		||||
 | 
			
		||||
@ -20,18 +20,14 @@ func Solve(buf []byte) (int, error) {
 | 
			
		||||
	for _, equation := range equations {
 | 
			
		||||
		go func() {
 | 
			
		||||
			var total int
 | 
			
		||||
			if res, ok := next(equation.target, equation.operands, total, joinOp); ok {
 | 
			
		||||
			res, _ := next(equation.target, equation.operands, total, joinOp)
 | 
			
		||||
			sumChan <- res
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
			sumChan <- 0
 | 
			
		||||
		}()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var sum int
 | 
			
		||||
	for range conc {
 | 
			
		||||
		res := <-sumChan
 | 
			
		||||
		sum += res
 | 
			
		||||
		sum += <-sumChan
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return sum, nil
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user