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

Function splitTaskIdentifier

codersdk/aitasks.go:244–258  ·  view source on GitHub ↗
(identifier string)

Source from the content-addressed store, hash-verified

242}
243
244func splitTaskIdentifier(identifier string) (owner string, taskName string, err error) {
245 parts := strings.Split(identifier, "/")
246
247 switch len(parts) {
248 case 1:
249 owner = Me
250 taskName = parts[0]
251 case 2:
252 owner = parts[0]
253 taskName = parts[1]
254 default:
255 return "", "", xerrors.Errorf("invalid task identifier: %q", identifier)
256 }
257 return owner, taskName, nil
258}
259
260// TaskByIdentifier fetches and returns a task by an identifier, which may be
261// either a UUID, a name (for a task owned by the current user), or a

Callers 2

TaskByIdentifierMethod · 0.85
Test_splitTaskIdentifierFunction · 0.85

Calls 1

ErrorfMethod · 0.45

Tested by 1

Test_splitTaskIdentifierFunction · 0.68