sensor-migrate

command
v0.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Command sensor-migrate upgrades a Go module from the SDK's pre-sensor API (sdk-go v0.6 and older: core.BaseAgent, client.WithAgentID, platform.AgentCredentials, ...) to the sensor API (RFC-023 §9.5).

Run it in the root of your module while it still builds against the old SDK:

go run github.com/openctemio/sdk-go/cmd/sensor-migrate@latest -dry-run   # show the diff
go run github.com/openctemio/sdk-go/cmd/sensor-migrate@latest            # rewrite + upgrade the SDK

It type-checks your code (the go/packages loader gopls uses) and renames only identifiers that resolve to SDK objects: a variable of yours called `agent`, or your own type AgentPool, is never touched. It also renames the embedded field of a struct that embeds a renamed SDK type (x.BaseAgent -> x.BaseSensor). If a new name would collide with one of yours, it reports every collision and changes nothing. String literals, struct tags and comments are left alone.

Files behind a build tag are only type-checked in a build that sets it: pass -tags once per extra build configuration (-tags platform, -tags "linux,cgo"). All configurations are checked against the old SDK before anything is written.

After rewriting it runs `go get github.com/openctemio/sdk-go@<version>`, where version is the release the command was run from (@latest above) or -sdk-version. A second run on the upgraded module finds nothing to rename, so the command is idempotent.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL