This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This repository contains example applications demonstrating the usage of the gotmc/usbtmc Go library for communicating with USB Test and Measurement Class (USBTMC) enabled devices.
Each example is its own Go module with an independent go.mod (no top-level go.mod). Build and run commands must be executed from within the example directory or via the Justfile recipes.
- key33220/ — Keysight/Agilent 33220A Function Generator (Go 1.21, usbtmc v0.8.0)
- keyu2751a/ — Keysight U2751A Matrix Switch (Go 1.12, usbtmc v0.4.0)
The project uses Just as the command runner:
just check # go fmt + go vet
just unit # unit tests with -race -short -cover
just unit -run TestName # run a single test
just lint # golangci-lint with .golangci.yaml config
just cover # HTML coverage report (unit tests by default)
just tidy # go mod tidy + verify
just update <mod> # update a single dependency
just updateall # update all dependencies
just outdated # list outdated direct deps (requires go-mod-outdated)
just docs # local pkgsite viewer
just ex1 # build and run key33220 example-
Driver Import: Examples use the Google gousb driver via blank import:
_ "github.com/gotmc/usbtmc/driver/google"(follows thedatabase/sqlregistration pattern). -
Device Creation: Examples connect either by VISA address string (
ctx.NewDevice(address)) or by VID/PID (ctx.NewDeviceByVIDPID(vid, pid)). -
Debug Levels: Both examples accept
-dor--debugCLI flags to set USB debug level.