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
| . | |
| ├── books | |
| │ ├── handlers.go | |
| │ └── models.go | |
| ├── config | |
| │ └── db.go | |
| └── main.go |
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
| # Change these variables as necessary. | |
| main_package_path = ./cmd/example | |
| binary_name = example | |
| # ==================================================================================== # | |
| # HELPERS | |
| # ==================================================================================== # | |
| ## help: print this help message | |
| .PHONY: help |
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 ( | |
| "encoding/json" | |
| "net/http" | |
| ) | |
| func main() {} | |
| func healthcheckHandlerEncoder(w http.ResponseWriter, r *http.Request) { |
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
| CREATE TABLE books ( | |
| isbn char(14) NOT NULL, | |
| title varchar(255), | |
| author varchar(255), | |
| price decimal(5,2) | |
| ); | |
| INSERT INTO books (isbn, title, author, price) VALUES | |
| ('978-1503261969', 'Emma', 'Jayne Austen', 9.44), | |
| ('978-1514274873', 'Journal of a Soldier', NULL, 5.49), |
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
| . | |
| ├── config | |
| │ └── config.go | |
| ├── go.mod | |
| ├── go.sum | |
| ├── main.go | |
| └── models | |
| └── books | |
| └── books.go |
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
| . | |
| ├── go.mod | |
| ├── handlers | |
| │ ├── books | |
| │ │ └── books.go | |
| │ └── env.go | |
| ├── main.go | |
| └── models | |
| └── models.go |
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
| name: Audit | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - 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
| func TestChain(t *testing.T) { | |
| used := "" | |
| mw1 := func(next http.Handler) http.Handler { | |
| return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | |
| used += "1" | |
| next.ServeHTTP(w, r) | |
| }) | |
| } |
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
| import ( | |
| "strings" | |
| "testing" | |
| "golang.org/x/net/html" | |
| "github.com/andybalholm/cascadia" | |
| ) | |
| func containsHTMLNode(t *testing.T, htmlBody, cssSelector string) bool { | |
| doc, err := html.Parse(strings.NewReader(htmlBody)) | |
| if err != nil { |
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 ( | |
| "crypto/rand" | |
| "crypto/subtle" | |
| "encoding/base64" | |
| "errors" | |
| "fmt" | |
| "log" | |
| "strings" |
NewerOlder