Skip to content

Commit 71cb596

Browse files
committed
Simplify
Signed-off-by: Jean-Laurent de Morlhon <[email protected]>
1 parent d8387d1 commit 71cb596

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

cmd/kamoulox/main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/jeanlaurent/kamoulox/pkg/kamoulox"
7+
)
8+
9+
func main() {
10+
fmt.Println(kamoulox.GenerateKamoulox())
11+
}

main.go renamed to pkg/kamoulox/kamoulox.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
1-
package main
1+
package kamoulox
22

33
import (
44
"fmt"
5-
"math/rand"
65
"unicode"
7-
)
8-
9-
func main() {
10-
kamoulox := Kamoulox{}
11-
fmt.Println(kamoulox.Generate())
12-
}
136

14-
// Kamoulox generates a famous kamoulox sentence
15-
type Kamoulox struct{}
7+
"math/rand"
8+
)
169

17-
func (k *Kamoulox) Generate() string {
10+
func GenerateKamoulox() string {
1811
firstVerb := randomElementFrom(verbs)
1912
firstObject := randomElementFrom(objects)
2013
return fmt.Sprintf("%s %s et %s %s.", capitalizeFirst(firstVerb), firstObject, randomElementFromExcluding(verbs, firstVerb), randomElementFromExcluding(objects, firstObject))

objects.go renamed to pkg/kamoulox/objects.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package kamoulox
22

33
var objects = []string{
44
"un caleçon",

verbs.go renamed to pkg/kamoulox/verbs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package kamoulox
22

33
var verbs = []string{
44
"j'enterre",

0 commit comments

Comments
 (0)