diff --git a/internal/haberdasherserver/server.go b/internal/haberdasherserver/server.go index 5df7aca..a9238e1 100644 --- a/internal/haberdasherserver/server.go +++ b/internal/haberdasherserver/server.go @@ -66,6 +66,9 @@ func HatQueryToHatQueryModel(q *pb.HatQuery) HatQuery { } func (s *Server) MakeHat(ctx context.Context, size *pb.Size) (hat *pb.Hat, err error) { + var colors []string = []string{"white", "black", "red", "blue", "white"} + var names []string = []string{"bowler", "baseball cap", "top hat", "derby", "tricorne"} + st, _ := NewStore(s.DBPath, 0600, nil) defer st.Close() @@ -75,8 +78,8 @@ func (s *Server) MakeHat(ctx context.Context, size *pb.Size) (hat *pb.Hat, err e h := Hat{ Inches: size.Inches, - Color: []string{"white", "black", "red", "blue"}[rand.Intn(4)], - Name: []string{"bowler", "baseball cap", "top hat", "derby"}[rand.Intn(3)], + Color: colors[rand.Intn(len(colors))], + Name: names[rand.Intn(len(names))], } fmt.Printf("made hat: %+v\n", h)