Skip to content

Commit

Permalink
internal/relui: remove workflowParams
Browse files Browse the repository at this point in the history
It's unused as of CL 422599.

For golang/go#54240.

Change-Id: I53628d167f0da8ae0bd255be230def3e8905aab4
Reviewed-on: https://go-review.googlesource.com/c/build/+/443059
Auto-Submit: Dmitri Shuralyov <[email protected]>
Run-TryBot: Dmitri Shuralyov <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Jenny Rakoczy <[email protected]>
  • Loading branch information
dmitshur authored and gopherbot committed Oct 18, 2022
1 parent 16b8a7c commit 2ca6ef6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
14 changes: 0 additions & 14 deletions internal/relui/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ func NewServer(p db.PGDBTX, w *Worker, baseURL *url.URL, header SiteHeader, ms *
"prettySize": prettySize,
"sidebarWorkflows": s.sidebarWorkflows,
"unmarshalResultDetail": unmarshalResultDetail,
"workflowParams": workflowParams,
}
s.templates = template.Must(template.New("").Funcs(helpers).ParseFS(templates, "templates/*.html"))
s.homeTmpl = s.mustLookup("home.html")
Expand Down Expand Up @@ -175,19 +174,6 @@ type homeResponse struct {
Schedules []ScheduleEntry
}

func workflowParams(wf db.Workflow) (map[string]string, error) {
rawParams := make(map[string]json.RawMessage)
err := json.Unmarshal([]byte(wf.Params.String), &rawParams)
if err != nil {
return nil, err
}
params := make(map[string]string, len(rawParams))
for p, v := range rawParams {
params[p] = string(v)
}
return params, nil
}

// homeHandler renders the homepage.
func (s *Server) homeHandler(w http.ResponseWriter, r *http.Request) {
q := db.New(s.db)
Expand Down
15 changes: 0 additions & 15 deletions internal/relui/web_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -802,19 +802,4 @@ func TestResultDetail(t *testing.T) {
}
})
}

}

func TestWorkflowParams(t *testing.T) {
got, err := workflowParams(db.Workflow{Params: nullString(`{"greeting": "hello", "names": ["alice", "bob"]}`)})
if err != nil {
t.Fatalf("workflowParams: err = %v, wanted no error", err)
}
want := map[string]string{
"greeting": `"hello"`,
"names": `["alice", "bob"]`,
}
if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("workflowParams mismatch (-want +got):\n%s", diff)
}
}

0 comments on commit 2ca6ef6

Please sign in to comment.