tarakan-client/internal/api/run_id.go
Maxfield Luke 58b29a7f84
Some checks failed
CI and releases / Test and vet (push) Failing after 1s
CI and releases / Build release binaries (push) Has been skipped
CI and releases / Publish GitHub release (push) Has been skipped
Initial commit on Forgejo
Fresh repository history for elektrine/tarakan-client hosted at
https://git.elektrine.com/elektrine/tarakan-client.
2026-07-29 04:56:36 -04:00

17 lines
403 B
Go

package api
import (
"crypto/rand"
"encoding/hex"
"fmt"
)
// NewRunID identifies one agent execution so network retries are idempotent
// without treating independent executions as duplicates.
func NewRunID() (string, error) {
raw := make([]byte, 16)
if _, err := rand.Read(raw); err != nil {
return "", fmt.Errorf("generate run id: %w", err)
}
return "run_" + hex.EncodeToString(raw), nil
}