Skip to content

uber-go/fx

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

Currently, there is nothing preventing somebody from making calls to
`app.Start` and `app.Stop` when it doesn't make sense, for example
calling `app.Start` or `app.Stop` twice, or trying to run the
application twice concurrently. Because of this lack of control, it's
possible for users to cause race conditions and panics (#991) by putting
the lifecycle is strange positions.

This PR places a small state machine in `Lifecycle` so that we can check
if calls to `(*Lifecycle).Start` and `(*Lifecycle).Stop` make sense
before going through. This will disallow starting an already
starting/started app, and stopping an already stopping/stopped app.
Tests to verify that are also added.
94f1a09

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Nov 26, 2022

🦄 Fx GoDoc Github release Build Status Coverage Status Go Report Card

Fx is a dependency injection system for Go.

Benefits

  • Eliminate globals: Fx helps you remove global state from your application. No more init() or global variables. Use Fx-managed singletons.
  • Code reuse: Fx lets teams within your organization build loosely-coupled and well-integrated shareable components.
  • Battle tested: Fx is the backbone of nearly all Go services at Uber.

See our docs to get started and/or learn more about Fx.

Installation

Use Go modules to install Fx in your application.

go get go.uber.org/fx@v1

Getting started

To get started with Fx, start here.

Stability

This library is v1 and follows SemVer strictly.

No breaking changes will be made to exported APIs before v2.0.0.

This project follows the Go Release Policy. Each major version of Go is supported until there are two newer major releases.