// Copyright 2018 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.packagehttp_testimport("fmt""log""net/http""sync")typecountHandlerstruct{musync.Mutex// guards nnint}func(h*countHandler)ServeHTTP(whttp.ResponseWriter,r*http.Request){h.mu.Lock()deferh.mu.Unlock()h.n++fmt.Fprintf(w,"count is %d\n",h.n)}funcExampleHandle(){http.Handle("/count",new(countHandler))log.Fatal(http.ListenAndServe(":8080",nil))}