我的 Go 代码如下:
```go
package main
import (
"fmt"
"context"
c "github.com/containerd/containerd"
cns "github.com/containerd/containerd/namespaces"
)
func dropE(funcName string,err error){
if err !=nil{
fmt.Printf("%v => %v\n",funcName,err)
}
}
func nginxExample(){
client,err := c.New("/run/containerd/containerd.sock")
dropE("containerd.New()",err)
defer client.Close()
ctx := cns.WithNamespace(context.Background(),"example")
image,err := client.Pull(ctx,"docker.io/library/redis:alpine",c.WithPullUnpack)
dropE("client.Pull()",err)
fmt.Printf("Secessfully pulled %v image\n",image.Name())
}
func main() {
fmt.Println("vim-go")
nginxExample()
}
```
在编译的时候,我遇见了如下报错,求助:
![](https://static.gocn.vip/photo/2020/b6a2ce9e-ff6e-48ed-953b-9c39186bbace.png?x-oss-process=image/resize,w_1920)
有疑问加站长微信联系(非本文作者))