So I was looking at the file here.
They call record := &accessLog
but they don't ever Initialize it as a variable first and if they do it that way if there are multiple simultaneous connections is there a possibility record will get over written with somebody else's data?
type accessLog struct {
ip, method, uri, protocol, host string
elapsedTime time.Duration
}
func LogAccess(w http.ResponseWriter, req *http.Request, duration time.Duration) {
clientIP := req.RemoteAddr
if colon := strings.LastIndex(clientIP, ":"); colon != -1 {
clientIP = clientIP[:colon]
}
record := &accessLog{
ip: clientIP,
method: req.Method,
uri: req.RequestURI,
protocol: req.Proto,
host: req.Host,
elapsedTime: duration,
}
writeAccessLog(record)
}