We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Just like as follows: `package main
import ( "fmt" "io" "io/ioutil" "log" "net/http" "os" "time"
"github.com/tcnksm/go-httpstat" "sync" //"runtime"
)
func worker(host string, wg *sync.WaitGroup) { req, err := http.NewRequest("GET", host, nil) if err != nil { wg.Done() return }
var result httpstat.Result ctx := httpstat.WithHTTPStat(req.Context(), &result) req = req.WithContext(ctx) client := http.DefaultClient client.Timeout = 5 * time.Second res, err := client.Do(req) if err != nil { wg.Done() return } if _, err := io.Copy(ioutil.Discard, res.Body); err != nil { wg.Done() return } res.Body.Close() result.End(time.Now()) fmt.Println(result) wg.Done()
}
func main() { args := os.Args if len(args) < 2 { log.Fatalf("Usage: go run main.go URL") }
//runtime.GOMAXPROCS(runtime.NumCPU()) var wg sync.WaitGroup for i := 0; i < 10; i++ { wg.Add(1) go worker(args[1], &wg) } wg.Wait()
}`
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Just like as follows:
`package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"time"
)
func worker(host string, wg *sync.WaitGroup) {
req, err := http.NewRequest("GET", host, nil)
if err != nil {
wg.Done()
return
}
}
func main() {
args := os.Args
if len(args) < 2 {
log.Fatalf("Usage: go run main.go URL")
}
}`
The text was updated successfully, but these errors were encountered: