Thanks for all the great work here folks! Just wanted to share two pain points I had when writing my first Go program to start / exec an interactive terminal following the API docs examples: incus package - github.com/lxc/incus/client - Go Packages
- It was not clear what to actually import to get access to
incus.<...>
andapi.<...>
- I was unable to create a container without modifying the default example
Here’s the main parts of the code in case it helps others:
import (
incus "github.com/lxc/incus/client"
"github.com/lxc/incus/shared/api"
)
// ...
req := api.InstancesPost{
Name: "first",
Type: "container",
Source: api.InstanceSource{
Type: "image",
Alias: "alpine/3.20",
Server: "https://images.linuxcontainers.org",
Protocol: "simplestreams",
},
}
Where Server
/ Protocol
are required.
Also the example references a name
variable further down which is not actually defined. Instead plain strings are used for the names. If there is interest in updating these docs, I can send a PR!