()
| 76 | } |
| 77 | |
| 78 | func main() { |
| 79 | if _numConcurrent > 0 && _requestInterval > 0 { |
| 80 | fmt.Println("error: you must set either _numConcurrent or _requestInterval > 0, but not both") |
| 81 | os.Exit(1) |
| 82 | } |
| 83 | |
| 84 | if _numConcurrent == 0 && _requestInterval == 0 { |
| 85 | fmt.Println("error: you must set either _numConcurrent or _requestInterval > 0") |
| 86 | os.Exit(1) |
| 87 | } |
| 88 | |
| 89 | url, jsonPathOrString := mustExtractArgs() |
| 90 | var jsonBytes []byte |
| 91 | if jsonPathOrString == "" { |
| 92 | jsonBytes = nil |
| 93 | } else if strings.HasPrefix(jsonPathOrString, "{") { |
| 94 | jsonBytes = []byte(jsonPathOrString) |
| 95 | } else { |
| 96 | jsonBytes = mustReadJSONBytes(jsonPathOrString) |
| 97 | } |
| 98 | |
| 99 | if _numConcurrent > 0 { |
| 100 | runConstantInFlight(url, jsonBytes) |
| 101 | } |
| 102 | |
| 103 | if _requestInterval > 0 { |
| 104 | runConstantRequestsPerSecond(url, jsonBytes) |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | func runConstantRequestsPerSecond(url string, jsonBytes []byte) { |
| 109 | inFlightCount := Counter{} |
nothing calls this directly
no test coverage detected