google / certificate-transparency-go

Auditing for TLS certificates (Go code)
https://certificate.transparency.dev
Apache License 2.0
861 stars 230 forks source link

Certificate Transparency: Go Code

Go Report Card GoDoc CodeQL workflow

This repository holds Go code related to Certificate Transparency (CT). The repository requires Go version 1.21.

Support

Repository Structure

The main parts of the repository are:

Trillian CT Personality

The trillian/ subdirectory holds code and scripts for running a CT Log based on the Trillian general transparency Log, and is documented separately.

Working on the Code

Developers who want to make changes to the codebase need some additional dependencies and tools, described in the following sections.

Running Codebase Checks

The scripts/presubmit.sh script runs various tools and tests over the codebase; please ensure this script passes before sending pull requests for review.

# Install golangci-lint
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.1

# Run code generation, build, test and linters
./scripts/presubmit.sh

# Run build, test and linters but skip code generation
./scripts/presubmit.sh  --no-generate

# Or just run the linters alone:
golangci-lint run

Rebuilding Generated Code

Some of the CT Go code is autogenerated from other files:

Re-generating mock or protobuffer files is only needed if you're changing the original files; if you do, you'll need to install the prerequisites:

With tools installed, run the following:

go generate -x ./...  # hunts for //go:generate comments and runs them