trunk
nate smith 2024-09-01 15:17:13 -05:00
parent 7b9ccf0ff2
commit b3294e880f
4 changed files with 4 additions and 13 deletions

View File

@ -3,7 +3,6 @@ package main
import ( import (
"errors" "errors"
"fmt" "fmt"
"math/rand"
"os" "os"
"os/user" "os/user"
"path" "path"
@ -71,8 +70,6 @@ func validExec(execPath string) error {
} }
func submit(opts *contribOpts) error { func submit(opts *contribOpts) error {
rand.Seed(time.Now().UTC().UnixNano())
var cmdName string var cmdName string
var category string var category string
var shortDesc string var shortDesc string

View File

@ -153,8 +153,6 @@ func _main() error {
r := newReviewer(signupDB, u.Username) r := newReviewer(signupDB, u.Username)
rand.Seed(time.Now().Unix())
su := models.TownSignup{} su := models.TownSignup{}
signups, err := su.All(signupDB) signups, err := su.All(signupDB)
@ -437,7 +435,8 @@ func _main() error {
if exiterr, ok := err.(*exec.ExitError); ok { if exiterr, ok := err.(*exec.ExitError); ok {
// no match or interrupt. who cares // no match or interrupt. who cares
switch exiterr.ExitCode() { switch exiterr.ExitCode() {
case 1: case 130: case 1:
case 130:
return return
} }
} }

View File

@ -3,13 +3,11 @@ package main
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil"
"math/rand" "math/rand"
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"strings" "strings"
"time"
"github.com/AlecAivazis/survey/v2" "github.com/AlecAivazis/survey/v2"
"github.com/charmbracelet/glamour" "github.com/charmbracelet/glamour"
@ -39,7 +37,6 @@ func main() {
} }
func visitRandomUser() error { func visitRandomUser() error {
rand.Seed(time.Now().UnixNano())
usernames, err := getUsernames() usernames, err := getUsernames()
if err != nil { if err != nil {
return err return err
@ -78,7 +75,7 @@ func visitPrompt() error {
} }
func visitUser(username string) error { func visitUser(username string) error {
files, err := ioutil.ReadDir(filepath.Join("/home", username)) files, err := os.ReadDir(filepath.Join("/home", username))
if err != nil { if err != nil {
return fmt.Errorf("user is not accepting visitors (could not read user's home directory: %w)", err) return fmt.Errorf("user is not accepting visitors (could not read user's home directory: %w)", err)
} }
@ -90,7 +87,7 @@ func visitUser(username string) error {
path := filepath.Join("/home", username, file.Name()) path := filepath.Join("/home", username, file.Name())
data, err := ioutil.ReadFile(path) data, err := os.ReadFile(path)
if err != nil { if err != nil {
break break
} }

View File

@ -12,7 +12,6 @@ import (
"os/user" "os/user"
"path/filepath" "path/filepath"
"syscall" "syscall"
"time"
email "git.tilde.town/tildetown/town/email" email "git.tilde.town/tildetown/town/email"
) )
@ -178,7 +177,6 @@ if you did _not_ request this, please let an admin know.
} }
func genGiteaPassword() string { func genGiteaPassword() string {
rand.Seed(time.Now().UnixNano())
b := make([]byte, 20) b := make([]byte, 20)
for i := range b { for i := range b {
b[i] = pwLetters[rand.Intn(len(pwLetters))] b[i] = pwLetters[rand.Intn(len(pwLetters))]