You could do:

```go
connection_headers := req.Header["Connection"]
if len(connection_headers) <= 0 {
  return false
}

connection_header := connection_headers[0]

if strings.ToLower(connection_header) != "upgrade" {
  return false
}

upgrade_headers, ok := req.Header["Upgrade"]
if !ok || len(upgrade_headers) <= 0 {
  return false
}

return strings.ToLower(upgrade_headers[0]) == "websocket"
```

But that's more a style preference.  Otherwise, if you keep it this way I would write `var connection_header string` at line 64.