This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stream { | |
| server { | |
| listen 443; | |
| resolver 1.1.1.1; | |
| proxy_connect_timeout 1s; | |
| proxy_timeout 3s; | |
| proxy_pass $ssl_preread_server_name:443; | |
| ssl_preread on; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| receivers: | |
| otlp: | |
| protocols: | |
| grpc: | |
| endpoint: 0.0.0.0:4317 | |
| http: | |
| endpoint: 0.0.0.0:4318 | |
| exporters: | |
| loadbalancing: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var updateCmd = &cobra.Command{ | |
| .... | |
| Run: func(cmd *cobra.Command, args []string) { | |
| if len(args) == 1 { | |
| todoName := args[0] | |
| for index, todo := range todos.Todos { | |
| if todo.Name == todoName { | |
| // check if --descriptions is passed as flag or not | |
| if cmd.Flags().Lookup("description").Changed { | |
| description, _ := cmd.Flags().GetString("description") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var removeCmd = &cobra.Command{ | |
| .... | |
| Run: func(cmd *cobra.Command, args []string) { | |
| if len(args) == 1 { | |
| todoName := args[0] | |
| for i := 0; i < len(todos.Todos); i++ { | |
| if todos.Todos[i].Name == todoName { | |
| todos.Todos = append(todos.Todos[0:i], todos.Todos[i+1:]...) | |
| break | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Todo struct { | |
| Name string `mapstructure:"name"` | |
| Description string `mapstructure:"description"` | |
| Deadline string `mapstructure:"deadline"` | |
| } | |
| type Todos struct { | |
| Todos []Todo `mapstructure:"todos"` | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## track index creation/re-indexing (available since version 12) | |
| ``` | |
| postgres=# select * from pg_stat_progress_create_index; | |
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "3" | |
| services: | |
| example-app: | |
| build: | |
| dockerfile: Dockerfile | |
| context: ./ | |
| volumes: | |
| - ./:/app | |
| ports: | |
| - 8080:8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Working directory | |
| # . or absolute path, please note that the directories following must be under root. | |
| root = "." | |
| tmp_dir = "tmp" | |
| [build] | |
| # Just plain old shell command. You could use `make` as well. | |
| cmd = "go build -o ./tmp/main ." | |
| # Binary file yields from `cmd`. | |
| bin = "tmp/main" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM golang:latest | |
| RUN go get -u github.com/cosmtrek/air | |
| WORKDIR /app | |
| ENTRYPOINT ["air"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "net/http" | |
| ) | |
| func main() { | |
| http.HandleFunc("/", func (w http.ResponseWriter, r *http.Request) { | |
| w.Write([]byte("Hello, World")) | |
| }) |
NewerOlder