How to convert string to float number [closed]

Change

if err != nil {

to

if err == nil {

(You may be doing this already, but unit testing is a great way to catch bugs like this.)