Common build tools and utilities for Aperture Robotics Go projects.
- template - Project template using this package
- protobuf-project - More extensive example
The aptre CLI tool replaces Make for building Go projects with protobuf support.
# Run directly
go run github.com/aperturerobotics/common/cmd/aptre@latest <command>
# Or install globally
go install github.com/aperturerobotics/common/cmd/aptre@latestStart by downloading the dependencies:
bun iProtobuf imports use Go paths and package names:
syntax = "proto3";
package example;
// Import .proto files using Go-style import paths.
import "github.com/aperturerobotics/controllerbus/controller/controller.proto";
// GetBusInfoResponse is the response type for GetBusInfo.
message GetBusInfoResponse {
// RunningControllers is the list of running controllers.
repeated controller.Info running_controllers = 1;
}To generate the protobuf files:
git add -A
go run ./cmd/aptre generate
# or with bun
bun run genThe aptre CLI provides the following commands:
| Command | Description |
|---|---|
generate |
Generate protobuf code (Go, TypeScript, C++) |
clean |
Remove generated files and cache |
deps |
Ensure all dependencies are installed |
lint |
Run golangci-lint |
fix |
Run golangci-lint with --fix |
test |
Run go test |
test --browser |
Run tests in browser with WebAssembly |
format |
Format Go code with gofumpt |
goimports |
Run goimports |
outdated |
Show outdated dependencies |
release run |
Create a release using goreleaser |
release bundle |
Create a bundled snapshot release |
release build |
Build a snapshot release |
release check |
Run goreleaser checks |
# Generate protobuf files
go run ./cmd/aptre generate
# Force regeneration (ignore cache)
go run ./cmd/aptre generate --force
# Run tests
go run ./cmd/aptre test
# Run browser/WASM tests
go run ./cmd/aptre test --browser
# Lint code
go run ./cmd/aptre lint
# Format code
go run ./cmd/aptre format
# Check for outdated dependencies
go run ./cmd/aptre outdatedC++ protobuf files (.pb.cc and .pb.h) are generated alongside the .pb.go
files. Add vendor/ to your include path and create a symlink for your project:
# CMakeLists.txt
set(VENDOR_LINK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vendor/github.com/yourorg")
if(NOT EXISTS "${VENDOR_LINK_DIR}/yourproject")
file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}" "${VENDOR_LINK_DIR}/yourproject" SYMBOLIC)
endif()
include_directories(${PROJECT_SOURCE_DIR}/vendor)#include "github.com/yourorg/yourproject/example/example.pb.h"The aptre tool uses an embedded WebAssembly version of protoc via go-protoc-wasi.
This means you don't need to install protoc separately - it works on any platform
that supports Go.
Please open a GitHub issue with any questions / issues.
... or feel free to reach out on Matrix Chat or Discord.
MIT