func main() {
    m := map[string]int{
        "foo": 42,
        "bar": 1337,
    }

    go func() {
        time.Sleep(1 * time.Second)
        tmp := map[string]int{
            "foo": 44,
            "bar": 1339,
        }

        m = tmp
    }()

    for {
        val := m["foo"]
        fmt.Println(val)
    }
}

I saw this in many packages.
Why this is not considered as a race condition?
go run -race . giving no error.

Is this a race condition in go
As pointed out by @Volker, this is a data race. And since there is only one write, it's hard to be detected. Here is a modified demo to make it easy to trigger the data race error:
package main

import (
    "fmt"
    "time"
)

func main() {
    m := map[string]int{
        "foo": 42,
        "bar": 1337,
    }

    done := make(chan any)

    go func() {
        for i := 0; i < 100; i++ {
            time.Sleep(time.Microsecond)
            tmp := map[string]int{
                "foo": 44,
                "bar": 1339,
            }

            m = tmp
        }

        close(done)
    }()

    for {
        select {
        case <-done:
            return
        default:
            val := m["foo"]
            fmt.Println(val)
        }
    }
}

