How to read a line from a file and replace it?

i want to replace these string,
i have tried reading lines and storing their text in a variable.
Like this :

fileIO, err := os.OpenFile("my.txt", os.O_RDWR, 0600)
            if err != nil {
            fmt.Println("Error ELOP0 ! Contact Support")

        }

        defer fileIO.Close()

        rawBytes, err := ioutil.ReadAll(fileIO)

        if err != nil {

            fmt.Println("Error EROP99X! Contact Support")

        }

        lines := strings.Split(string(rawBytes), "\n")

        for i, line := range lines {

            if i == 27 {

                defowner = line

            }

        }

but the issue here is sometimes maybe there is a space between these lines or maybe any line is on the top or on the bottom or middle so the result is not correct.

i have searched a lot but didn’t find any proper way to read values from a text file.

the thing i want to do is :

this is the text of hello.txt file :

sharedip=x.x.x.x
build=5.114
version=5.0

i want to read sharedip in a variable , so maybe shared IP is at the bottom or after build so it’s not possible to get accurate result from the way i tried.

is there any other method?