log.Fatal(http.ListenAndServe("127.0.0.1:9098", r))
ports:
- "9097:8080"
log.Fatal(http.ListenAndServe(":8080", r))
type InlineKeyboard [][]InlineKeyboardButton
type InlineKeyboardButton struct {
Text string
Url string
CallbackData interface{}
}
fullData := ProductFullData{
Name: product.Name,
Code: price.Code,
InStock: product.InStock,
Price2: price.Price2,
Price3: price.Price2,
}
client_max_body_size 0;
proxy_http_version 1.1;
proxy_pass http://your.websocket.backend/;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
ffmpeg -i image-%03d.png video.mp4
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
type Response struct {
Version string `json:"version"`
Data map[string][]interface{} `json:"data"`
}
func main() {
var client http.Client
resp, err := client.Get("https://api.myjson.com/bins/by9gw")
if err != nil {
panic(err)
}
defer resp.Body.Close()
simpleResp := Response{}
fmt.Println("Response code:", resp.StatusCode)
if resp.StatusCode == http.StatusOK {
bodyBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
_ = json.Unmarshal(bodyBytes, &simpleResp)
sampleArr := simpleResp.Data["sampleArray"]
fmt.Println(sampleArr[0])
fmt.Println(sampleArr[1])
casted, ok := sampleArr[2].(map[string]interface{})
if !ok {
panic("Wrong type of sampleArr element")
}
fmt.Println("Name:")
fmt.Println(casted["name"])
}
}
package main
import "golang.org/x/tour/pic"
func Pic(dx, dy int) [][]uint8 {
array := make([][]uint8, dy)
for y := 0; y < dy; y++ {
array[y] = make([]uint8, dx)
for x := 0; x < dx; x++ {
pixel := uint8((x + y) / 2)
array[y][x] = pixel
}
}
return array
}
func main() {
pic.Show(Pic)
}