Skip to content

Commit

Permalink
Fix gofmt pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
FluxCapacitor2 committed Jul 21, 2024
1 parent 5c5d6d5 commit de1c7a8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
56 changes: 28 additions & 28 deletions app/server/pagination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,38 @@ func TestPagination(t *testing.T) {
// Cursor in the middle of the results
{page: 5, pageCount: 20,
want: []resultsPage{
{Number:"«", Current:false, URL:"http://localhost:8080/?page=1&q=hello&source=test"},
{Number:"←" ,Current:false, URL:"http://localhost:8080/?page=4&q=hello&source=test"},
{Number:"1" ,Current:false, URL:"http://localhost:8080/?page=1&q=hello&source=test"},
{Number:"2" ,Current:false, URL:"http://localhost:8080/?page=2&q=hello&source=test"},
{Number:"3" ,Current:false, URL:"http://localhost:8080/?page=3&q=hello&source=test"},
{Number:"4" ,Current:false, URL:"http://localhost:8080/?page=4&q=hello&source=test"},
{Number:"5" ,Current:true, URL:"http://localhost:8080/?page=5&q=hello&source=test"},
{Number:"6" ,Current:false, URL:"http://localhost:8080/?page=6&q=hello&source=test"},
{Number:"7" ,Current:false, URL:"http://localhost:8080/?page=7&q=hello&source=test"},
{Number:"8" ,Current:false, URL:"http://localhost:8080/?page=8&q=hello&source=test"},
{Number:"9" ,Current:false, URL:"http://localhost:8080/?page=9&q=hello&source=test"},
{Number:"10", Current:false, URL:"http://localhost:8080/?page=10&q=hello&source=test"},
{Number:"→" ,Current:false, URL:"http://localhost:8080/?page=6&q=hello&source=test"},
{Number:"»" ,Current:false, URL:"http://localhost:8080/?page=20&q=hello&source=test"},
{Number: "«", Current: false, URL: "http://localhost:8080/?page=1&q=hello&source=test"},
{Number: "←", Current: false, URL: "http://localhost:8080/?page=4&q=hello&source=test"},
{Number: "1", Current: false, URL: "http://localhost:8080/?page=1&q=hello&source=test"},
{Number: "2", Current: false, URL: "http://localhost:8080/?page=2&q=hello&source=test"},
{Number: "3", Current: false, URL: "http://localhost:8080/?page=3&q=hello&source=test"},
{Number: "4", Current: false, URL: "http://localhost:8080/?page=4&q=hello&source=test"},
{Number: "5", Current: true, URL: "http://localhost:8080/?page=5&q=hello&source=test"},
{Number: "6", Current: false, URL: "http://localhost:8080/?page=6&q=hello&source=test"},
{Number: "7", Current: false, URL: "http://localhost:8080/?page=7&q=hello&source=test"},
{Number: "8", Current: false, URL: "http://localhost:8080/?page=8&q=hello&source=test"},
{Number: "9", Current: false, URL: "http://localhost:8080/?page=9&q=hello&source=test"},
{Number: "10", Current: false, URL: "http://localhost:8080/?page=10&q=hello&source=test"},
{Number: "→", Current: false, URL: "http://localhost:8080/?page=6&q=hello&source=test"},
{Number: "»", Current: false, URL: "http://localhost:8080/?page=20&q=hello&source=test"},
}},
// Cursor at the end
{page: 20, pageCount: 20,
want: []resultsPage{
{Number:"«", Current:false, URL:"http://localhost:8080/?page=1&q=hello&source=test"},
{Number:"←", Current:false, URL:"http://localhost:8080/?page=19&q=hello&source=test"},
{Number:"11", Current:false, URL:"http://localhost:8080/?page=11&q=hello&source=test"},
{Number:"12", Current:false, URL:"http://localhost:8080/?page=12&q=hello&source=test"},
{Number:"13", Current:false, URL:"http://localhost:8080/?page=13&q=hello&source=test"},
{Number:"14", Current:false, URL:"http://localhost:8080/?page=14&q=hello&source=test"},
{Number:"15", Current:false, URL:"http://localhost:8080/?page=15&q=hello&source=test"},
{Number:"16", Current:false, URL:"http://localhost:8080/?page=16&q=hello&source=test"},
{Number:"17", Current:false, URL:"http://localhost:8080/?page=17&q=hello&source=test"},
{Number:"18", Current:false, URL:"http://localhost:8080/?page=18&q=hello&source=test"},
{Number:"19", Current:false, URL:"http://localhost:8080/?page=19&q=hello&source=test"},
{Number:"20", Current:true, URL:"http://localhost:8080/?page=20&q=hello&source=test"},
{Number:"→", Current:true, URL:"http://localhost:8080/?page=21&q=hello&source=test"},
{Number:"»", Current:true, URL:"http://localhost:8080/?page=20&q=hello&source=test"},
{Number: "«", Current: false, URL: "http://localhost:8080/?page=1&q=hello&source=test"},
{Number: "←", Current: false, URL: "http://localhost:8080/?page=19&q=hello&source=test"},
{Number: "11", Current: false, URL: "http://localhost:8080/?page=11&q=hello&source=test"},
{Number: "12", Current: false, URL: "http://localhost:8080/?page=12&q=hello&source=test"},
{Number: "13", Current: false, URL: "http://localhost:8080/?page=13&q=hello&source=test"},
{Number: "14", Current: false, URL: "http://localhost:8080/?page=14&q=hello&source=test"},
{Number: "15", Current: false, URL: "http://localhost:8080/?page=15&q=hello&source=test"},
{Number: "16", Current: false, URL: "http://localhost:8080/?page=16&q=hello&source=test"},
{Number: "17", Current: false, URL: "http://localhost:8080/?page=17&q=hello&source=test"},
{Number: "18", Current: false, URL: "http://localhost:8080/?page=18&q=hello&source=test"},
{Number: "19", Current: false, URL: "http://localhost:8080/?page=19&q=hello&source=test"},
{Number: "20", Current: true, URL: "http://localhost:8080/?page=20&q=hello&source=test"},
{Number: "→", Current: true, URL: "http://localhost:8080/?page=21&q=hello&source=test"},
{Number: "»", Current: true, URL: "http://localhost:8080/?page=20&q=hello&source=test"},
}},
}

Expand Down
2 changes: 1 addition & 1 deletion app/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ type togglableSource struct {
func renderTemplateWithResults(db database.Database, config *config.Config, req *http.Request, w http.ResponseWriter, t *template.Template, templateName string) {
src := req.URL.Query()["source"]
q := req.URL.Query().Get("q")
page, err := strconv.ParseUint(req.URL.Query().Get("page"),10,32)
page, err := strconv.ParseUint(req.URL.Query().Get("page"), 10, 32)

var results []database.Result
var total *uint32
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"lint-staged": {
"*.tmpl": "prettier --write",
"*.go": "gofmt"
"*.go": "gofmt -w"
},
"scripts": {
"prepare": "husky install"
Expand Down

0 comments on commit de1c7a8

Please sign in to comment.