Skip to content

gorums: replace mustParseURL with url.MustParse once Go 1.28 is released #372

Open

Description

@meling

Go 1.28 is expected to add url.MustParse.
Once Go 1.28 is released and the module's minimum Go version allows it, replace the internal must* wrappers that duplicate standard-library behavior.
This is low priority.

Candidates

  • mustParseURL(t, s) in internal/conn/peer_verifier_test.go.
    It is on master now, because the peer identity work merged.
    Replace it with url.MustParse.
    Check whether the test still wants t.Fatal instead of a panic; a panic on a constant literal is acceptable.

Reviewed on master: no replacement planned

These helpers have no standard-library equivalent.
They call t.Fatalf with test-specific context, or wait on Gorums state.

  • mustNewTree (tree_test.go): wraps NewTree.
  • mustWaitForInbound, mustWaitForClients (server_internal_test.go): wait with a 2-second timeout.
  • mustOpen (benchkit/cmd/sweep/aggregate_test.go): os.Open plus t.Cleanup.
  • mustReduce (benchkit/cmd/sweep/plotmode_test.go): drops the second return value; the name is misleading and could become reduceCDF.
  • mustExecute (cmd/protoc-gen-gorums/gengorums/template_funcs.go): panics on a template execution error.
    Go has template.Must for parsing only, so there is no standard replacement.
    Parsing already uses template.Must.

Task

When Go 1.28 ships, grep for must[A-Z] helpers again.
Replace any that now have a standard-library Must* twin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions