-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtraining_data.jsonl
3 lines (3 loc) · 2.73 KB
/
training_data.jsonl
1
2
3
{"messages": [{"role": "system", "content": "You are a Go developer who writes robust error-handling functions."}, {"role": "user", "content": "Write the following functions: Now, NewPlanner, Add, with robust error handling."}, {"role": "assistant", "content": "func NewPlanner() *Planner {\n\treturn &Planner{\n\t\tplans: make(map[string]*Plan),\n\t\tresources: NewResourcePool(),\n\t}\n}\n\n// CreatePlan creates a new hierarchical plan\nfunc (p *Planner) CreatePlan(ctx context.Context, req CreatePlanRequest) (*Plan, error) {\n\tlog.Info(\"Creating plan\", \"name\", req.Name)\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\n\tplan := &Plan{\n\t\tID: generateID(),\n\t\tName: req.Name,\n\t\tDescription: req.Description,\n\t\tGoals: make([]Goal, 0),\n\t\tTimeline: Timeline{\n\t\t\tStartTime: time.Now(),\n\t\t\tEndTime: req.EndTime,\n\t\t},\n\t\tResources: *NewResourcePool(), // Create a new ResourcePool instance\n\t\tStatus: PlanStatusCreated,\n\t\tCreatedAt: time.Now(),\n\t\tUpdatedAt: time.Now(),\n\t}\n\n\t// Initialize goals and objectives\n\tfor _, goalReq := range req.Goals {\n\t\tgoal := Goal{\n\t\t\tID: generateID(),\n\t\t\tName: goalReq.Name,\n\t\t\tDescription: goalReq.Description,\n\t\t\tPriority: goalReq.Priority,\n\t\t\tStatus: GoalStatusPending,\n\t\t\tDeadline: goalReq.Deadline,\n\t\t}\n\n\t\t// Create objectives for each goal\n\t\tfor _, objReq := range goalReq.Objectives {\n\t\t\tobjective := Objective{\n\t\t\t\tID: generateID(),\n\t\t\t\tName: objReq.Name,\n\t\t\t\tDescription: objReq.Description,\n\t\t\t\tStatus: ObjectiveStatusPending,\n\t\t\t\tDeadline: objReq.Deadline,\n\t\t\t}\n\t\t\tgoal.Objectives = append(goal.Objectives, objective)\n\t\t}\n\n\t\tplan.Goals = append(plan.Goals, goal)\n\t}\n\n\tp.plans[plan.ID] = plan\n\treturn plan, nil\n}"}]}
{"messages": [{"role": "system", "content": "You are a Go developer who writes robust error-handling functions."}, {"role": "user", "content": "Write the following functions: MustVoid, with robust error handling."}, {"role": "assistant", "content": "func MustVoid(err error) {\n\tif err != nil {\n\t\tError(err)\n\t\tpanic(err)\n\t}\n}"}]}
{"messages": [{"role": "system", "content": "You are a Go developer who writes robust error-handling functions."}, {"role": "user", "content": "Write the following functions: SafeMustVoid, with robust error handling."}, {"role": "assistant", "content": "func SafeMustVoid(fn func() error) {\n\tif fn == nil {\n\t\tError(errors.New(\"SafeMustVoid called with nil function\"))\n\t\tpanic(\"SafeMustVoid called with nil function\")\n\t}\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tLog(\"Recovered from panic in SafeMustVoid: %v\", r)\n\t\t}\n\t}()\n\tMustVoid(fn())\n}"}]}