()
| 170 | } |
| 171 | |
| 172 | func generateBillingID() string { |
| 173 | b := make([]byte, 16) |
| 174 | if _, err := rand.Read(b); err != nil { |
| 175 | // crypto/rand failure means the OS RNG is broken — propagating |
| 176 | // would force every caller to handle an error that effectively |
| 177 | // can't happen on a healthy system. Panic so the failure is |
| 178 | // visible immediately rather than silently producing colliding |
| 179 | // all-zero IDs. |
| 180 | panic(fmt.Sprintf("billing: crypto/rand failed: %v", err)) |
| 181 | } |
| 182 | return fmt.Sprintf("ue_%s", hex.EncodeToString(b)) |
| 183 | } |
| 184 | |
| 185 | // CurrentDate returns today's date as a string in YYYY-MM-DD format. |
| 186 | func CurrentDate() string { |
no test coverage detected