To build and start the jaegertracing/jaeger-lib project, follow these detailed steps:

Prerequisites

Ensure that you have:

  • Go installed and configured properly
  • Access to a terminal and a Go workspace set up

Step 1: Clone the Repository

Begin by cloning the repository to your local machine:

git clone https://github.com/jaegertracing/jaeger-lib.git
cd jaeger-lib

Step 2: Install Dependencies

Use the Makefile provided in the repository to install the necessary dependencies.

Run the following command:

make install

This command will trigger the installation process specified in the Makefile. The relevant part of the Makefile looks like this:

.PHONY: install
install:
ifeq ($(USE_DEP),true)
    dep version || make install-dep
    dep version
    dep ensure -vendor-only
    dep status
else ifeq ($(USE_GLIDE),true)
    glide --version || go get github.com/Masterminds/glide
    glide --version
    glide install
endif

If you are using the dep tool for dependency management, ensure that it is installed using:

make install-dep

This will download dep and make it executable.

Step 3: Build the Project

Next, build the project to ensure that everything compiles correctly. This can be done via:

go build ./...

You may refer to the Makefile segment below for various build commands:

.PHONY: test-and-lint
test-and-lint: test fmt lint

The test-and-lint target can be used for comprehensive checking, which includes tests and code linting.

Step 4: Run Tests

To ensure that the project is functioning properly, run all tests using:

make test

This command utilizes the following relevant code from the Makefile:

.PHONY: test
test: dep-check
    $(GOTEST) $(PACKAGES) | $(COLORIZE)

Step 5: Lint and Format Code

Optionally, you can also lint and format the codebase:

make lint

To format the code, execute:

make fmt

Step 6: View Test Coverage

If you want to check test coverage, you can generate a coverage report by running:

make cover

To view the coverage report in HTML format, use the command:

make cover-html

Step 7: Create Release

If you are preparing for a release, follow these steps:

  1. Create a pull request with a title like “Preparing release 2.1.0”.
  2. Update the CHANGELOG.md with recent changes from the commit history:
git log --pretty=format:'- %s -- %an'
  1. Once the pull request has been merged, create the release on GitHub.

Step 8: Start the Project

After confirming that the project is built and tested successfully, you can run the application. The specific starting command depends on the designed entry point of your application.

For example, if your main application is in cmd/yourapp/main.go:

go run cmd/yourapp/main.go

Conclusion

You have successfully built and started the jaegertracing/jaeger-lib project. Make sure to check logs and outputs for any issues and follow best practices for further enhancements or configurations.

Sources:

  • Makefile
  • README.md
  • RELEASE.md