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

uber-go / fx / 2360
91%
master: 92%

Build:
Build:
LAST BUILD BRANCH: glue-dig-b3
DEFAULT BRANCH: master
Ran 11 Mar 2017 10:36PM UTC
Jobs 1
Files 53
Run time 3s
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

pending completion
2360

push

travis-ci

sectioneight
Add task.MustRegister which panics on error

Although panics are generally frowned upon, there are certain cases
where they can make developers' lives easier. Particularly for the task
module, the general use case is that in the `main` func (or some other
func called by `main` during initialization), there is no way to recover
from the error and we want to crash the process.

In abscence of MustRegister, a developer who wishes to register many
tasks must check the error of each, and upon encountering an error will
almost certainly want to exit the program with a non-zero exit code
since the service should not start if the task functions are not
properly defined.

In other words, it turns this:

  if err := task.Register(FirstTaskFunc); err != nil {
    log.Fatal("Could not register task", err.Error())
  }
  if err := task.Register(SecondTaskFunc); err != nil {
    log.Fatal("Could not register task", err.Error())
  }

Into this:

  task.MustRegister(FirstTaskFunc)
  task.MustRegister(SecondTaskFunc)

Both of which behave semantically similar (although the output may be
slightly different).

This gives developers the flexibility to choose which behavior they
want, similar to `regexp.MustCompile` from the standard library, where a
program should not start if the developer incorrectly constructed a
regular expression.

3 of 3 new or added lines in 1 file covered. (100.0%)

2813 of 3083 relevant lines covered (91.24%)

24.38 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
3
100.0
modules/task/execution.go
Jobs
ID Job ID Ran Files Coverage
2 2360.2 (DOCKER_GO_VERSION=1.8 CI_TEST_CMD=coveralls) 11 Mar 2017 10:36PM UTC 0
91.24
Travis Job 2360.2
Source Files on build 2360
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #2360
  • a6b6376e on github
  • Next Build on must-register (#2364)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc