httptest1 Go - select - 출처: https://quii.gitbook.io/learn-go-with-tests/go-fundamentals/select - 개요 http 요청 test를 작성하는법을 알아본다. goroutine 사용시 동기화를 위해 select를 이용해본다. - WebsiteRace example 두 URL을 받아서 HTTP GET 요청을 날렸을 때 먼저 응답한 URL을 반환하는 WebsiteRace 함수를 작성해보자. 만약 두 URL 모두 10초내로 답변이 없으면 error를 반환한다. 우선 요구사항에 맞게 간단하게 test 코드를 작성해보자. func TestRacer(t *testing.T) { slowURL := "http://www.facebook.com" fastURL := "http://www.q.. 2022. 1. 12. 이전 1 다음