sensor-migrate

command
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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, ...) to the sensor API (RFC-023 §9.5). pkg/platform is removed (no OpenCTEM API served its routes): code that used it has nothing to migrate to and must drop it.

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