All jobs

Migrate From satori/go.uuid to google/uuid in a Go App

Yes. An agent swaps satori/go.uuid for google/uuid, rewrites each constructor call whose signature differs, and proves the generated values still match.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The two packages share a type name and almost nothing else at the call site, so the agent starts by listing every symbol the code takes from github.com/satori/go.uuid. In a tool like codesenberg/bombardier there is one import, in bombardier.go, aliased as uuid, and five uses: the functions uuid.NewV1 through uuid.NewV5 are handed to a template.FuncMap under the names UUIDV1 to UUIDV5, so that a user's own output template can print a fresh identifier. go.mod pins github.com/satori/go.uuid v1.2.0 and declares go 1.22.

Changing the import path alone does not build. The compiler answers with five errors of the form undefined: uuid.NewV1, one per constructor, because google/uuid names them differently and gives most of them another shape. The agent maps each one: NewV1 becomes uuid.NewUUID, NewV4 becomes uuid.NewRandom, and both now return a value and an error, which text/template accepts from a function. NewV3 and NewV5 took the name as a string; uuid.NewMD5 and uuid.NewSHA1 take bytes, so each gets a two-line wrapper that converts. NewV2(domain byte) has no single counterpart. The wrapper calls uuid.NewDCEPerson or uuid.NewDCEGroup for the two domains that have one, and uuid.NewDCESecurity otherwise.

Because these functions are reachable from files the repository does not contain, the agent tests them the way a user would. It writes a small template that calls all five, including {{ UUIDV5 UUIDV4 "name" }} to pass one function's result to another, builds the binary before and after, and runs each against a local HTTP server with --format path: pointing at the template. Both binaries must exit 0 and print five well-formed identifiers. A separate program imports both libraries and checks that the name-based versions agree: for the DNS namespace and example.com, both produce cfbff0d1-9375-5685-968c-48ce8b15ae17 as version 5.

It finishes with go mod tidy, go vet and the test suite, and reads template/doc.go, which documents the helper signatures for template authors. That file already lists UUIDV1() (UUID, error) and UUIDV4() (UUID, error), which the pinned v1.2.0 never had; after the change the comment is true, and the agent says so instead of editing it.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Replace github.com/satori/go.uuid with github.com/google/uuid in this Go module. First list every file that imports the old package and every symbol it uses (NewV1 to NewV5, FromString, FromBytes, Must, Nil, Equal, the Namespace variables, NullUUID). Run go build, go vet and go test and record the results before changing anything. Then port each use: NewUUID for version 1, NewRandom for version 4, NewMD5 and NewSHA1 with a byte conversion for versions 3 and 5, the DCE constructors for version 2, Parse for FromString. Where a function is exposed to users (a template function, a flag, a public API), keep its name and argument types and wrap the new call. Write a short program or test that imports both libraries and shows version 3 and version 5 give the same value for the same namespace and name, and that every string format the code parses is accepted by both. If the binary takes user templates, run the old and new builds with a template that calls each exposed function. Run go mod tidy, go vet, go test and govulncheck. Open a pull request with each command and its output, and list any signature a caller will see change.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

A pull request that changes bombardier.go, one require line in go.mod and the matching lines in go.sum. The description carries the symbol inventory, the five compile errors from the bare import swap, the mapping table, both binaries' output for the probe template, and the equality check for the name-based versions.

The reviewer reads the wrappers first. The version 2 wrapper is the one judgment call: for a domain other than person or group, the old library wrote a zero id and the new one asks for the id as an argument, so the wrapper passes 0. They also check the list of visible changes. Here the template functions keep their names and arguments, and two of them gain an error result that a template never sees unless it is not nil. Nothing in this repository stores or parses identifiers, so there is no data to convert; in a service that does, the description shows which accepted input forms were tested.

Run it on every weekly dependency check

Unmaintained modules do not show up as failed builds, so nothing prompts the work. Add an automation on the Project with a schedule trigger, for example cron set to 0 6 * * 1, and save the prompt above as its prompt. Each Monday a run starts in the repository; when the old import is already gone it reports that and opens nothing.

For a group of services, send this body to POST /o/{org}/sessions once per repository, each with a request_id that is a UUID v5 of the repository name so a retried script starts nothing twice. Requests past the key's max_concurrent answer 202 with status: "queued" and start as earlier runs finish.

The use case this job follows, with its automation and trigger: Upgrade dependencies weekly.

Why run it on Rush?

The risk in this swap is not the import line. It is a wrapper that compiles and returns a different identifier than before for the same input, which would change every derived key in a system that hashes names into version 5 values. That is settled by running both libraries side by side, and the run keeps the program, the command and the printed values in its transcript, where a reviewer can read them.

The agent works in its own sandbox with the Go toolchain, so building two binaries, starting a throwaway HTTP server and running a load tool against it touches nothing of yours. The pull request is the only thing that reaches the repository, and it arrives with the evidence already attached.

Frequently asked questions

Do version 3 and version 5 UUIDs stay the same after the move?

Yes. Both libraries hash the namespace and the name as the specification describes, and the check in the run prints one value from each for the same input. The agent adds that comparison to the pull request so the claim is shown and not assumed.

What replaces uuid.FromString?

uuid.Parse, which returns the value and an error in the same way. Both parsers accept the canonical form, the form with no hyphens and the form in braces. uuid.MustParse is the counterpart for code that used uuid.Must(uuid.FromString(s)).

Is satori/go.uuid at v1.2.0 flagged by govulncheck?

Not at this pin. Running govulncheck on this repository lists the module among those scanned and reports nothing against it. The agent runs the scan on your module instead of relying on that, because a pseudo-version newer than the last tag can differ.

Will database columns or JSON output change?

The text form is the same 36 characters, and both types marshal to it. If your code scans identifiers from SQL or uses NullUUID, the agent lists those places and runs the affected tests, since that is where a driver-level difference would appear.

More jobs like this: Upgrade dependencies weekly

Keep reading