Rename Random() to Hack()
This commit is contained in:
parent
abec5d2651
commit
ef8f4176b1
|
@ -35,7 +35,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if count == 1 {
|
if count == 1 {
|
||||||
sentence, err := hq.Random()
|
sentence, err := hq.Hack()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -45,7 +45,7 @@ func main() {
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("")
|
fmt.Println("")
|
||||||
for i := 0; i < count; i++ {
|
for i := 0; i < count; i++ {
|
||||||
sentence, err := hq.Random()
|
sentence, err := hq.Hack()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (f *Frontend) home(w http.ResponseWriter, r *http.Request) {
|
func (f *Frontend) home(w http.ResponseWriter, r *http.Request) {
|
||||||
words, err := f.hq.Random()
|
words, err := f.hq.Hack()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.Write([]byte(err.Error()))
|
w.Write([]byte(err.Error()))
|
||||||
return
|
return
|
||||||
|
|
|
@ -19,7 +19,7 @@ func NewGeneric(db database.DB) (HackerQuotes, error) {
|
||||||
return &generic{db: db}, nil
|
return &generic{db: db}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *generic) Random() (string, error) {
|
func (g *generic) Hack() (string, error) {
|
||||||
definite := rand.Int() % 2 == 0
|
definite := rand.Int() % 2 == 0
|
||||||
hasAdj := rand.Int() % 2 == 0
|
hasAdj := rand.Int() % 2 == 0
|
||||||
plural := rand.Int() % 2 == 0
|
plural := rand.Int() % 2 == 0
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type HackerQuotes interface {
|
type HackerQuotes interface {
|
||||||
// Random returns a completely randomized quote.
|
// Hack returns a completely randomized quote.
|
||||||
Random() (string, error)
|
Hack() (string, error)
|
||||||
|
|
||||||
// Format returns a quote in the given format.
|
// Format returns a quote in the given format.
|
||||||
Format(format string) (string, error)
|
Format(format string) (string, error)
|
||||||
|
|
Loading…
Reference in New Issue