Skip to content

Commit

Permalink
Fix linter issues (#118)
Browse files Browse the repository at this point in the history
* chore: fix linter issues

* chore: fix linter issues, update ver
  • Loading branch information
TimVosch authored Oct 7, 2024
1 parent 3cee548 commit efd0b46
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ docs:

lint:
@echo "Running linters..."
docker run --rm -v $(CURDIR):/app -w /app golangci/golangci-lint:v1.55.2 \
golangci-lint run --out-format github-actions
docker pull golangci/golangci-lint:latest
docker run --rm -v $(CURDIR):/app -w /app golangci/golangci-lint:latest \
golangci-lint run --out-format colored-line-number

python-clean:
ifeq ($(strip $(OUTDIR)),)
Expand Down
4 changes: 3 additions & 1 deletion services/core/transport/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import (

type middleware = func(http.Handler) http.Handler

var ctxDeviceKey = struct{}{}
type ctxKey string

var ctxDeviceKey ctxKey = "device"

func (t *CoreTransport) useDeviceResolver() middleware {
return func(next http.Handler) http.Handler {
Expand Down
6 changes: 3 additions & 3 deletions services/dashboard/routes/overview.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (t *OverviewRoute) createSensorGroup() http.HandlerFunc {
web.HTTPError(w, err)
return
}
w.Header().Set("hx-push-url", views.U("/overview?"+r.URL.Query().Encode()))
w.Header().Set("hx-push-url", views.U("/overview?%s", r.URL.Query().Encode()))
w.Header().Set("hx-trigger-after-settle", "newDeviceList")
views.WriteRenderFilters(w, sg, true)
views.WriteRenderDeviceTable(w, res.Data, getCursor(res.Links.GetNext()))
Expand All @@ -109,7 +109,7 @@ func (t *OverviewRoute) deleteSensorGroup() http.HandlerFunc {
web.HTTPError(w, err)
return
}
w.Header().Set("hx-push-url", views.U("/overview?"+r.URL.Query().Encode()))
w.Header().Set("hx-push-url", views.U("/overview?%s", r.URL.Query().Encode()))
w.Header().Set("hx-trigger-after-settle", "newDeviceList")
views.WriteRenderFilters(w, nil, true)
views.WriteRenderDeviceTable(w, res.Data, getCursor(res.Links.GetNext()))
Expand Down Expand Up @@ -138,7 +138,7 @@ func (t *OverviewRoute) getDevicesTable() http.HandlerFunc {

nextCursor := ""
if res.Links.GetNext() != "" {
nextCursor = views.U("/overview/devices/table?cursor=" + getCursor(res.Links.GetNext()))
nextCursor = views.U("/overview/devices/table?cursor=%s", getCursor(res.Links.GetNext()))
}
views.WriteRenderDeviceTableRows(w, res.Data, nextCursor)
}
Expand Down
6 changes: 3 additions & 3 deletions services/dashboard/routes/pipelines.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (h *PipelinePageHandler) pipelineListPage() http.HandlerFunc {
Pipelines: pipelines.Data,
}
if pipelines.Links.GetNext() != "" {
page.PipelinesNextPage = views.U("/pipelines/table?cursor=" + getCursor(pipelines.Links.GetNext()))
page.PipelinesNextPage = views.U("/pipelines/table?cursor=%s", getCursor(pipelines.Links.GetNext()))
}
if isHX(r) {
page.WriteBody(w)
Expand Down Expand Up @@ -395,7 +395,7 @@ func (h *PipelinePageHandler) getPipelinesTable() func(w http.ResponseWriter, r

nextCursor := ""
if res.Links.GetNext() != "" {
nextCursor = views.U("/pipelines/table?cursor=" + getCursor(res.Links.GetNext()))
nextCursor = views.U("/pipelines/table?cursor=%s", getCursor(res.Links.GetNext()))
}
views.WriteRenderPipelineTableRows(w, res.Data, nextCursor)
}
Expand Down Expand Up @@ -472,7 +472,7 @@ func (h *PipelinePageHandler) resolveWorkers(next http.Handler) http.Handler {

nextCursor := ""
if workers.Links.GetNext() != "" {
nextCursor = views.U("/pipelines/workers/table?cursor=" + getCursor(workers.Links.GetNext()))
nextCursor = views.U("/pipelines/workers/table?cursor=%s", getCursor(workers.Links.GetNext()))
}

ctx = context.WithValue(
Expand Down
4 changes: 2 additions & 2 deletions services/dashboard/routes/workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (h *WorkerPageHandler) listWorkers() http.HandlerFunc {
page.WorkersNextPage = res.Links.GetNext()

if res.Links.GetNext() != "" {
page.WorkersNextPage = views.U("/workers/table?cursor=" + getCursor(res.Links.GetNext()))
page.WorkersNextPage = views.U("/workers/table?cursor=%s", getCursor(res.Links.GetNext()))
}

fmt.Println("Cursor", res.Links.GetNext())
Expand All @@ -80,7 +80,7 @@ func (h *WorkerPageHandler) workersTable() http.HandlerFunc {

nextCursor := ""
if res.Links.GetNext() != "" {
nextCursor = views.U("/workers/table?cursor=" + getCursor(res.Links.GetNext()))
nextCursor = views.U("/workers/table?cursor=%s", getCursor(res.Links.GetNext()))
}

if isHX(r) {
Expand Down
2 changes: 1 addition & 1 deletion services/tenants/transports/webui/routes/api-keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (h *APIKeysPageHandler) apiKeysGetTableRows() http.HandlerFunc {

nextPage := ""
if apiKeyPage.Cursor != "" {
nextPage = views.U("/api-keys/table?cursor=" + apiKeyPage.Cursor)
nextPage = views.U("/api-keys/table?cursor=%s", apiKeyPage.Cursor)
}

viewKeys := []views.APIKey{}
Expand Down
4 changes: 3 additions & 1 deletion services/tenants/transports/webui/routes/kratos.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ func (k KratosRoutes) httpDefaultPage() http.HandlerFunc {
}
}

var ctxFlow = struct{}{}
type ctxKey string

var ctxFlow ctxKey = "flow"

func (k KratosRoutes) redirectStartFlow(w http.ResponseWriter, r *http.Request, flow KratosFlow) {
http.Redirect(w, r, fmt.Sprintf("%s/self-service/%s/browser", k.kratosPublicURI, flow), http.StatusSeeOther)
Expand Down

0 comments on commit efd0b46

Please sign in to comment.