Make hat size random
This commit is contained in:
parent
e2cf17ff80
commit
75cba09617
@ -3,12 +3,15 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"haberdasher-twirp/haberdasher"
|
"haberdasher-twirp/haberdasher"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const MaxSize = 12
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var host string = "http://localhost:8080"
|
var host string = "http://localhost:8080"
|
||||||
if len(os.Args) > 1 {
|
if len(os.Args) > 1 {
|
||||||
@ -17,7 +20,7 @@ func main() {
|
|||||||
|
|
||||||
client := haberdasher.NewHaberdasherProtobufClient(host, &http.Client{})
|
client := haberdasher.NewHaberdasherProtobufClient(host, &http.Client{})
|
||||||
|
|
||||||
hat, err := client.MakeHat(context.Background(), &haberdasher.Size{Inches: 12})
|
hat, err := client.MakeHat(context.Background(), &haberdasher.Size{Inches: int32(rand.Intn(MaxSize))})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("oh no: %v\n", err)
|
fmt.Printf("oh no: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user