package main import ( "fmt" "log" "github.com/go-resty/resty/v2" "github.com/joho/godotenv" ) func output(_ *resty.Client, _ string, width, height int, arr [][]Cell) { for i := 0; i < width; i++ { for j := 0; j < height; j++ { if arr[i][j].live { fmt.Printf("*") } else { fmt.Printf(" ") } } fmt.Printf("\n") } } func main() { // Load .env file if it exists err := godotenv.Load(".env") if err != nil { log.Fatal("Error loading .env file") } // Load env server data url, width, height := loadMatrixData() log.Printf("At '%s': %d x %d\n", url, width, height) // Initialize resty client client := resty.New() // Run Game of Life done := setup(func(c [][]Cell) { output(client, url, width, height, c) }, width, height, 5) // Wait for user input to quit var input string fmt.Scanln(&input) // Stop Game of Life, wait for routine done <- true // // Initialize custom matrix data // col := Color{R: 255, G: 0, B: 255, Endpoint: COLOR} // rct := Rectangle{X: 0, Y: 0, W: 10, H: 10, Endpoint: RECTANGLE} // // // Send request to remote server // sendRequest(client, url, []interface{}{col, rct}) // // // Initialize custom matrix data // col = Color{R: 255, G: 255, B: 0, Endpoint: COLOR} // rct = Rectangle{X: 15, Y: 15, W: 15, H: 15, Endpoint: RECTANGLE} // upd := Update{Endpoint: UPDATE} // // // Send request to remote server // sendRequest(client, url, []interface{}{col, rct, upd}) }