MCPcopy Index your code
hub / github.com/coder/coder / parseTargetRange

Function parseTargetRange

cli/exp_scaletest.go:2334–2362  ·  view source on GitHub ↗
(name, targets string)

Source from the content-addressed store, hash-verified

2332}
2333
2334func parseTargetRange(name, targets string) (start, end int, err error) {
2335 if targets == "" {
2336 return 0, 0, nil
2337 }
2338
2339 parts := strings.Split(targets, ":")
2340 if len(parts) != 2 {
2341 return 0, 0, xerrors.Errorf("invalid target %s %q", name, targets)
2342 }
2343
2344 start, err = strconv.Atoi(parts[0])
2345 if err != nil {
2346 return 0, 0, xerrors.Errorf("invalid target %s %q: %w", name, targets, err)
2347 }
2348
2349 end, err = strconv.Atoi(parts[1])
2350 if err != nil {
2351 return 0, 0, xerrors.Errorf("invalid target %s %q: %w", name, targets, err)
2352 }
2353
2354 if start == end {
2355 return 0, 0, xerrors.Errorf("invalid target %s %q: start and end cannot be equal", name, targets)
2356 }
2357 if end < start {
2358 return 0, 0, xerrors.Errorf("invalid target %s %q: end cannot be less than start", name, targets)
2359 }
2360
2361 return start, end, nil
2362}
2363
2364func createWorkspaceAppConfig(client *codersdk.Client, appHost, app string, workspace codersdk.Workspace, agent codersdk.WorkspaceAgent) (workspacetraffic.AppConfig, error) {
2365 if app == "" {

Callers 2

getTargetedWorkspacesMethod · 0.85
scaletestDashboardMethod · 0.85

Calls 1

ErrorfMethod · 0.45

Tested by

no test coverage detected