Skip to content

🧹 Remove deprecated rand.Seed in internal/names/names.go#91

Merged
filmil merged 1 commit into
mainfrom
fix-deprecated-rand-seed-names-14137866915054273792
May 16, 2026
Merged

🧹 Remove deprecated rand.Seed in internal/names/names.go#91
filmil merged 1 commit into
mainfrom
fix-deprecated-rand-seed-names-14137866915054273792

Conversation

@filmil

@filmil filmil commented May 16, 2026

Copy link
Copy Markdown
Owner

🎯 What: Removed the deprecated rand.Seed(time.Now().UnixNano()) call and the unused time import from internal/names/names.go.
💡 Why: Since Go 1.20, the global random number generator is automatically seeded, making manual seeding obsolete and deprecated. Removing it improves code health and simplifies the init function.
Verification: Verified by manually generating the names_data.go file (using the local generator) and running go test ./internal/names/.... All tests passed.
Result: Cleaned up deprecated code and removed an unnecessary dependency on the time package.


PR created automatically by Jules for task 14137866915054273792 started by @filmil

Removed the deprecated rand.Seed call and the unused time import.

This commit has been created by an automated coding assistant, with human supervision.

# 🧹 Code Health Improvement Task

You are a code health agent. Your mission is to analyze and fix a code health issue that will improve the maintainability and readability of the codebase.

## Task Details

**File:** internal/names/names.go:11
**Issue:** Deprecated math/rand.Seed

**Language:** go

**Current Code:**
```go
var loadedNames []string

func init() {
	rand.Seed(time.Now().UnixNano())
}

// GenerateForIndex returns a random name from the pre-loaded list.
```

**Rationale:** Go 1.20+ automatically seeds the global random number generator, making rand.Seed obsolete. The fix is a simple removal of the init function.

## Your Process

### 1. 🔍 UNDERSTAND - Analyze the Code Health Issue
* Review the surrounding code and understand its purpose
* Identify the specific code health problem (duplication, complexity, naming, dead code, deprecated usage, etc.)
* Consider how this issue affects maintainability and readability

### 2. ⚖️ ASSESS - Evaluate the Risk
Before making changes, assess the impact:
* What other code depends on or references this code?
* Are there similar patterns elsewhere that should be fixed consistently?
* What is the risk of inadvertently breaking functionality?

### 3. 📋 PLAN - Design the Improvement
Based on your assessment, plan your approach:
* What is the ideal state of this code?
* Are there existing patterns in the codebase to follow?
* Will this change affect other parts of the codebase?

### 4. 🔧 IMPLEMENT - Refactor with Care
* Write clean, readable code that addresses the issue
* Follow existing codebase patterns and conventions
* Preserve all existing functionality
* Ensure the fix doesn't introduce new issues
* Update or write additional tests if the refactoring warrants coverage
* Add or update documentation if needed

### 5. ✅ VERIFY - Validate the Improvement
- Run format and lint checks
- Run the full test suite
- Verify the code health issue is resolved
- Ensure no functionality is broken

### 6. 📝 DOCUMENT - Explain the Improvement
Create a PR with:
- Title: "🧹 [code health improvement description]"
- Description with:
  * 🎯 **What:** The code health issue addressed
  * 💡 **Why:** How this improves maintainability
  * ✅ **Verification:** How you confirmed the change is safe
  * ✨ **Result:** The improvement achieved

Remember: Code health improvements should make the codebase better without changing behavior. When in doubt, preserve functionality over cleanliness.

Co-authored-by: filmil <246576+filmil@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@filmil filmil merged commit 6bd84a2 into main May 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant