一个文件两个不同的输出-Windows Server 2012

My program reads in an sql file and performs operation on a database.

I edited one of the sql files on the server via notepad yesterday.

I made one more change on the same file today, again via notepad.

When program reads in the file, the changes I made to the sql are not there.

Printing the sql contents to the console reveals that the binary is reading in the version from yesterday.

What black magic is at play here?

Deleting the file does not work.

If I create it again the Date created time stamp is from 1 month ago. Date modified is from yesterday.

Opening the file in notepad, wordpad any text reader you can think of shows the correct contents.

Binary reads the version from yesterday.

This is how the binary reads the file

file, err := ioutil.ReadFile("appointment.sql")
if err != nil {
    log.Fatal(err)
}

Program was cross compiled for windows on a mac.

Sql files were written originally on a mac via vim and then uploaded to the server.

EDIT: I include the code from the method after suggested debugging.

func (r *Icar) ReadAppointments(qCfg dms.QueryConfig) []dms.Appointment {
    // r.conn contains the db connection

    /*DEBUGGING*/
    name := "appointment.sql"
    fmt.Printf("%q
", name)
    path, err := filepath.Abs(name)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("%q
", path) //correct path

    file, err := ioutil.ReadFile("appointment.sql")
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("%q
", file) //correct output
    /*END*/

    appointmentQuery := string(file)

    fmt.Println(appointmentQuery) //correct output

    appointmentQuery = strings.Replace(appointmentQuery, "@", qCfg.QueryLocationID, -1)

    fmt.Println(appointmentQuery) //correct output

    rows, err := r.conn.Query(appointmentQuery)
    if err != nil {
        fmt.Println(appointmentQuery) //wrong output. output contains edits from a previous version
        log.Fatal("Error reading from the database: %s", err.Error())
    }

    appointments := []dms.Appointment{}

    var (
        ExternalID,
        WONumber,
        CustomerWaiting interface{}
    )

    for rows.Next() {
        appointment := dms.Appointment{}

        err = rows.Scan(&ExternalID, &WONumber, &appointment.AppointmentDate, &CustomerWaiting)
        if err != nil {
            fmt.Println(appointmentQuery)
            log.Fatal(err)
        }

        toStr := []interface{}{ExternalID, WONumber}
        toInt := []interface{}{CustomerWaiting}

        convertedString := d.ConvertToStr(toStr)
        convertedInt := d.ConvertToInt(toInt)

        appointment.ExternalID = convertedString[0]
        appointment.WONumber = convertedString[1]
        appointment.CustomerWaiting = convertedInt[0]

        appointments = append(appointments, appointment)
    }

    err = rows.Close()

    return appointments
}

I close the db connection in a deferred statement in my main func.

Here is the constructor for reference

func New(config QueryConfig) (*Icar, func()) {

    db, err := sql.Open("odbc", config.Connection)
    if err != nil {
        log.Fatal("The database doesn't open correctly:
", err.Error())
    }

    icar := &Icar{
        conn: db,
    }

    return icar, func() {
        icar.conn.Close()
    }
}

Basic debugging says check your inputs and outputs. You may be looking at different files. Clearly, "appointment.sql" is not necessarily unique in the file system. For example, does this give you expected results?

package main

import (
    "fmt"
    "io/ioutil"
    "log"
    "path/filepath"
)

func main() {
    name := "appointment.sql"
    fmt.Printf("%q
", name)
    path, err := filepath.Abs(name)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("%q
", path)
    file, err := ioutil.ReadFile(name)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("%q
", file)
}

Output:

"appointment.sql"
"C:\\Users\\peter\\gopath\\src\\so\\appointment.sql"
"SELECT * FROM appointments;
"