• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

m-lab / autojoin / 37804191450
70%

Build:
DEFAULT BRANCH: main
Ran 08 Oct 2026 03:52PM UTC
Jobs 1
Files 19
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

08 Oct 2026 03:51PM UTC coverage: 70.41% (-0.9%) from 71.291%
37804191450

push

github

web-flow
fix(register)!: handle json.Unmarshal error (#109)

This patch updates `cmd/register/main.go` to handle
`json.Unmarshal` errors, which are possible depending
on what the response looks like. For example, a
truncated response could cause `Unmarshal` to fail.

We use `rtx.Must`, which logs and exits `1`.

While there, prefer an error message and `Exit(1)` to
panicking when the `register` API call failed.

While there, notice that the response has many pointers,
and act accordingly. Make sure it's well formed to
avoid null dereferences a few lines below.

Based on review comments, we normalized the file itself
to use `log.Fatal/log.Fatalf` on error, so that the
error message always consistently goes to the stderr.

Also, based on review comments, we move all the
checks at top, to ensure that the request is well
formed with non-empty fields, to avoid writing just
some of the files and then exiting because the
data we received from the remote service is wrong.

While there, note that logging the response is
not a good idea once we get `200 OK`, because doing
this might put the service account key on the systemd
journal, which allows anyone in `adm` to read it.

BREAKING CHANGE: `panic` exits with exit code `2` but I'm
not convinced about keeping `2` in the new code: `2` is
usually reserved for "usage error", and in the current
codebase makes sense for "validating" input quickly, while
`1` seems a better semantic translation of "the response
does not look good, sorry, goodbye!".

Co-authored-by: Roberto D'Auria <roberto@measurementlab.net>

0 of 30 new or added lines in 1 file covered. (0.0%)

1 existing line in 1 file now uncovered.

1254 of 1781 relevant lines covered (70.41%)

0.78 hits per line

Uncovered Changes

Lines Coverage ∆ File
30
0.0
0.0% cmd/register/main.go

Coverage Regressions

Lines Coverage ∆ File
1
0.0
0.0% cmd/register/main.go
Jobs
ID Job ID Ran Files Coverage
1 0 - 37804191450.1 08 Oct 2026 03:52PM UTC 19
70.41
GitHub Action Run
Source Files on build 37804191450
  • Tree
  • List 19
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • fcb97ddd on github
  • Prev Build on main (#37797006279)
  • Next Build on main (#37832476042)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc