metal-stack / metal-api

API to manage and control plane resources like machines, switches, operating system images, machine sizes, networks, IP addresses and more
GNU Affero General Public License v3.0
126 stars 9 forks source link

remove dead code #508

Closed ulrichSchreiner closed 4 months ago

ulrichSchreiner commented 4 months ago

remove dead code.

in the image-service the result of ListMachines is only used later when doing the lookup via machinesByImage. But after this lookup we have a nested if-construct where the inner "if" is always false as it was checked a few lines above. so the if len(machiens) ... is alway an empty block and can be removed. so the whole Listmachines .

same in network-service as the if err != nil is always false.

Gerrit91 commented 4 months ago

Great that you found this. Can't we just remove the inner if-clauses that check the error to make the code behave as it was intended?

ulrichSchreiner commented 4 months ago

ok, code changed so it behaves like the author originally wanted