Blacklane's multi-module repository for Go libraries :)
It's a work in progress, everyone is welcome to help. We use GitHub Issues for bug report and requests.
Follow the Releasing Process
flowchart LR
github.com/blacklane/go-libs/otel --> github.com/blacklane/go-libs/logger
github.com/blacklane/go-libs/otel --> github.com/blacklane/go-libs/tracking
github.com/blacklane/go-libs/otel --> github.com/blacklane/go-libs/x/events
github.com/blacklane/go-libs/otel --> github.com/rs/zerolog
github.com/blacklane/go-libs/otel --> go.opentelemetry.io/otel
github.com/blacklane/go-libs/middleware --> github.com/blacklane/go-libs/camunda/v2
github.com/blacklane/go-libs/middleware --> github.com/blacklane/go-libs/logger
github.com/blacklane/go-libs/middleware --> github.com/blacklane/go-libs/otel
github.com/blacklane/go-libs/middleware --> github.com/blacklane/go-libs/tracking
github.com/blacklane/go-libs/middleware --> github.com/blacklane/go-libs/x/events
github.com/blacklane/go-libs/x/events --> github.com/blacklane/go-libs/tracking
github.com/blacklane/go-libs/x/events --> github.com/confluentinc/confluent-kafka-go
github.com/blacklane/go-libs/x/events --> go.opentelemetry.io/otel
github.com/blacklane/go-libs/logger --> github.com/blacklane/go-libs/tracking
github.com/blacklane/go-libs/logger --> github.com/blacklane/go-libs/x/events
github.com/blacklane/go-libs/logger --> github.com/rs/zerolog
github.com/blacklane/go-libs/camunda/v2 --> github.com/blacklane/go-libs/logger
github.com/blacklane/go-libs/probes --> github.com/go-chi/chi
tools
: download all dev toolsgolangci-lint
: run golangci-lint in all modulesgo-mod-tidy
: rungo mod tidy
in all modulesmisspell
: run misspell in all*.md
fileslint
: executego-mod-tidy
,golangci-lint
andmisspell
generate
: rungo generate ./...
in all modulesbuild
: rungo build ./...
in all modulestest
: rungo test ./...
in all modules, extra targets are also provided:test-race
test-bench
test-short
test-verbose
test-coverage
: run test coverage and merge all results in acoverage.txt
filego-work-init
: initialize go workspace to help in local developmentprerelease
: create prerelease branch for the providedMODSET
(configured in versions.yaml file)prerelease-all
: create a prerelease branch for every versionadd-tags
: create all tags for the actual versions, aCOMMIT
can be specifiedpush-tags
: push tags matching theVERSION
param to origin
Every folder is a library, currently we have:
- logger: a wrapper around zerolog and compliant with our standards
- tracking: adds UUID and other things to the context
- x: Experimental, they are experiments or work in progress which are not ready to be recommended as a standard
The maintainers of each library is defines in the CODEOWNERS file. If the library does not provide one, consider the top-level CODEOWNERS as the maintainers.
As defined by Go modules we use semantic versioning as defined by semver.
The tag for version 1.2.3 of module "my-repo/foo/rop" is "foo/rop/v1.2.3".
They should be prefixed by the affected module, e.g.:
logger: release vx.y.z
tracking: add functions to read/set Gopher name in the context
For commit messages we follow the Go project standard as much as possible.
A rule of thumb is that it should be written so to complete the sentence "This change modifies X to _____." That means it does not start with a capital letter, is not a complete sentence, and actually summarizes the result of the change.
- Set
GOPRIVATE=github.com/blacklane/*
. For details check the docs. Note that, you should avoid the Go proxy and Go sum database. - Ensure
go get
makes authenticated calls to Github. In order to do so, configuregit
authentication either for HTTPS or SSH
Make git
to use https://[email protected]/
instead of https://github.com/
, where GITHUB_TOKEN
is your personal access token
To do so run: git config --global url.https://[email protected]/.insteadOf https://github.com
Alternatively you can manually edit your ~/.gitconfig
and add the following:
[url "https://[email protected]/"]
insteadOf = https://github.com/
This is the best option to be used when building a docker image, also GITHUB_TOKEN
is already available on our drone
Make git
to use ssh://[email protected]/
instead of https://github.com/
To do so run: git config --global url.ssh://[email protected]/.insteadOf https://github.com/
Alternatively you can manually edit your ~/.gitconfig
and add the following:
[url "ssh://[email protected]/"]
insteadOf = https://github.com/
This is the most common for local setup as usually git authentication over SSH is already configured.
-
Ensure your git authentication is set up and working by cloning a private repo over HTTPS:
git clone https://github.com/blacklane/go-libs.git
-
Ensure
GOPRIVATE
is set and containsgithub.com/blacklane/*
:go env | grep GOPRIVATE
-
When building a docker image, ensure you pass
GITHUB_TOKEN
as a build argument:[docker|docker-build] build --build-arg GITHUB_TOKEN=$GITHUB_TOKEN