Golang one goroutine write, one read, will it also produce static?

problem description

func main() {
    n := 0
    go func() {
        for {
            n = n+1
        }
    }()


    for {
        fmt.Println(n)
    }

}

Why does this situation still lead to competition

Apr.12,2022

n uses the same variable


two goroutine operations on the same variable, of course there will be competition

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36839-4105e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36839-4105e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?