Refactor kafka to pure Go (franz-go), fix DBC stubs, update Dockerfile

This commit is contained in:
Chris Rai
2026-01-31 00:05:47 -05:00
parent fbb820d7b3
commit b5bec57dfa
776 changed files with 18945 additions and 2052 deletions

View File

@@ -0,0 +1,8 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
// Treat as warning until Dependabot supports commitlint.
// https://github.com/dependabot/dependabot-core/issues/2445
"body-max-line-length": [1, "always", 100],
}
};

View File

@@ -0,0 +1,6 @@
{
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0"
}
}

View File

@@ -0,0 +1,16 @@
commitlint_cwd := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
commitlint := $(commitlint_cwd)/node_modules/.bin/commitlint
$(commitlint): $(commitlint_cwd)/package.json
$(info [commitlint] installing package...)
@cd $(commitlint_cwd) && npm install --no-save --no-audit &> /dev/null
@touch $@
.PHONY: commitlint
commitlint: $(commitlint_cwd)/.commitlintrc.js $(commitlint)
$(info [$@] linting commit messages...)
@git fetch --tags
@NODE_PATH=$(commitlint_cwd)/node_modules $(commitlint) \
--config $< \
--from origin/master \
--to HEAD

View File

@@ -0,0 +1,9 @@
#!/bin/bash
set -euo pipefail
if [[ -n $(git status --porcelain) ]]; then
echo "Staging area is dirty, please add all files created by the build to .gitignore"
git diff --patch
exit 1
fi

View File

@@ -0,0 +1,7 @@
git_verify_nodiff_cwd := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
git_verify_nodiff := $(git_verify_nodiff_cwd)/git-verify-nodiff.bash
.PHONY: git-verify-nodiff
git-verify-nodiff:
@echo verifying that git has no diff...
@$(git_verify_nodiff)

View File

@@ -0,0 +1,24 @@
golangci_lint_cwd := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
golangci_lint_version := 1.37.0
golangci_lint := $(golangci_lint_cwd)/$(golangci_lint_version)/golangci-lint
ifeq ($(shell uname),Linux)
golangci_lint_archive_url := https://github.com/golangci/golangci-lint/releases/download/v${golangci_lint_version}/golangci-lint-${golangci_lint_version}-linux-amd64.tar.gz
else ifeq ($(shell uname),Darwin)
golangci_lint_archive_url := https://github.com/golangci/golangci-lint/releases/download/v${golangci_lint_version}/golangci-lint-${golangci_lint_version}-darwin-amd64.tar.gz
else
$(error unsupported OS: $(shell uname))
endif
$(golangci_lint):
$(info building golangci-lint...)
@mkdir -p $(dir $@)
@curl -sSL $(golangci_lint_archive_url) -o - | \
tar -xz --directory $(dir $@) --strip-components 1
@chmod +x $@
@touch $@
.PHONY: go-lint
go-lint: $(golangci_lint)
$(info linting Go code with golangci-lint...)
@$(golangci_lint) run

View File

@@ -0,0 +1,18 @@
goreview_cwd := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
goreview_version := 0.15.0
goreview := $(goreview_cwd)/$(goreview_version)/goreview
goreview_archive_url := https://github.com/einride/goreview/releases/download/v$(goreview_version)/goreview_$(goreview_version)_$(shell uname)_$(shell uname -m).tar.gz
$(goreview): $(goreview_cwd)/rules.mk
$(info [goreview] fetching $(goreview_version) binary...)
@mkdir -p $(dir $@)
@curl -sSL $(goreview_archive_url) -o - | tar -xz --directory $(dir $@)
@chmod +x $@
@touch $@
# go-review: review Go code for Einride-specific conventions
.PHONY: go-review
go-review: $(goreview)
$(info [$@] reviewing Go code for Einride-specific conventions...)
@$(goreview) -c 1 ./...

View File

@@ -0,0 +1,19 @@
plugins:
- - "@semantic-release/commit-analyzer"
- preset: "conventionalcommits"
releaseRules:
# Given Go v2+ conventions we disable major releases on
# breaking changes and leave it up to the developer
# to make major releases
- breaking: true
release: "minor"
- "@semantic-release/release-notes-generator"
- "@semantic-release/github"
branches: ["master"]
# github plugin is the only one running this step and we're not interested
# in its updates to PR and issues
success: false
# github plugin is the only one running this step and we're not interested
# the issues it creates due to failed releases
fail: false

View File

@@ -0,0 +1,8 @@
{
"devDependencies": {
"semantic-release": "^17.3.0",
"@semantic-release/github": "^7.2.0",
"@semantic-release/release-notes-generator": "^9.0.1",
"conventional-changelog-conventionalcommits": "^4.5.0"
}
}

View File

@@ -0,0 +1,12 @@
semantic_release_cwd := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
semantic_release := $(semantic_release_cwd)/node_modules/.bin/semantic-release
$(semantic_release): $(semantic_release_cwd)/package.json
$(info [semantic-release] installing packages...)
@cd $(semantic_release_cwd) && npm install --no-save --no-audit --ignore-scripts &> /dev/null
@touch $@
.PHONY: semantic-release
semantic-release: $(semantic_release_cwd)/.releaserc.yaml $(semantic_release)
$(info [$@] creating release...)
@cd $(semantic_release_cwd) && $(semantic_release)

View File

@@ -0,0 +1,5 @@
module tools/stringer
go 1.13
require golang.org/x/tools v0.0.0-20200609164405-eb789aa7ce50

View File

@@ -0,0 +1,20 @@
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200609164405-eb789aa7ce50 h1:59syOWj4+Fl+op4LL8fX1kO7HmbdEWfxlw4tcGvH+y0=
golang.org/x/tools v0.0.0-20200609164405-eb789aa7ce50/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View File

@@ -0,0 +1,8 @@
stringer_cwd := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
stringer := $(stringer_cwd)/bin/stringer
PATH := $(PATH):$(dir $(stringer))
$(stringer): $(stringer_cwd)/go.mod
@echo building stringer...
@cd $(stringer_cwd) && go build -o $@ golang.org/x/tools/cmd/stringer
@cd $(stringer_cwd) && go mod tidy

View File

@@ -0,0 +1,5 @@
//+build tool
package tool
import _ "golang.org/x/tools/cmd/stringer"