# Distributed Services with Go: nearestMultiple function linting error, (page 72)

**URL:** <https://forum.devtalk.com/t/distributed-services-with-go-nearestmultiple-function-linting-error-page-72/17798>\
**Category:** PragProg Customers\
**Tags:** book-distributed-services-with-go, errata\
**Created:** [17 August 2021 22:45 UTC](https://forum.devtalk.com/t/distributed-services-with-go-nearestmultiple-function-linting-error-page-72/17798 "2021-08-17T22:45:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elesq](https://forum.devtalk.com/user_avatar/forum.devtalk.com/elesq/32/3278_2.png) [@elesq](https://forum.devtalk.com/u/elesq)\
**Post date:** [17 August 2021 22:45 UTC](https://forum.devtalk.com/t/distributed-services-with-go-nearestmultiple-function-linting-error-page-72/17798/1 "2021-08-17T22:45:18Z")

</div>

Page 72 shows implementation of the nearestMultiple function. (as per below)

```auto
func​ nearestMultiple(j, k ​uint64​) ​uint64​ { ​  
​ if​ j >= 0 { ​ ​
        return​ (j / k) * k ​  
    } ​  
    ​return​ ((j - k + 1) / k) * k ​ ​  
}

```

This causes a listing error (go-staticcheck) in VScode: **every value of type uint64 is \>= 0 (SA4003)**

---

<div class="post-metadata">

**Author:** ![travisjeffery](https://forum.devtalk.com/user_avatar/forum.devtalk.com/travisjeffery/32/525_2.png) [@travisjeffery](https://forum.devtalk.com/u/travisjeffery)\
**Post date:** [18 August 2021 18:28 UTC](https://forum.devtalk.com/t/distributed-services-with-go-nearestmultiple-function-linting-error-page-72/17798/2 "2021-08-18T18:28:19Z")

</div>

Replace the \>= with ==.

---

<div class="post-metadata">

**Author:** ![akolybelnikov](https://forum.devtalk.com/user_avatar/forum.devtalk.com/akolybelnikov/32/3750_2.png) [@akolybelnikov](https://forum.devtalk.com/u/akolybelnikov)\
**Post date:** [19 January 2022 12:18 UTC](https://forum.devtalk.com/t/distributed-services-with-go-nearestmultiple-function-linting-error-page-72/17798/3 "2022-01-19T12:18:51Z")

</div>

> [@elesq](#):
>
> ```auto
> func​ nearestMultiple(j, k ​uint64​) ​uint64​ { ​  
> ​ if​ j >= 0 { ​ ​
> return​ (j / k) * k ​  
> } ​  
> ​return​ ((j - k + 1) / k) * k ​ ​  
> }
> 
> ```

In this case the the return value will always be 0 and we don’t need the calculation. Maybe something like this:

```auto
func​ nearestMultiple(j, k ​uint64​) ​uint64​ { ​  
​ if​ j - k >= 0 { ​ ​
        return​ (j / k) * k ​  
    } ​  
    ​return​ 0 ​ ​  
}

```

---

<div class="post-metadata">

**Author:** ![jbarratt](https://forum.devtalk.com/user_avatar/forum.devtalk.com/jbarratt/32/3781_2.png) [@jbarratt](https://forum.devtalk.com/u/jbarratt)\
**Post date:** [22 January 2022 23:55 UTC](https://forum.devtalk.com/t/distributed-services-with-go-nearestmultiple-function-linting-error-page-72/17798/4 "2022-01-22T23:55:26Z")

</div>

Am I missing something or is this functional also never called?

I gepped through the example source and only see the definitions, but it’s never used, and the static checker complains about that as well.
