go test 报错 exec: "gcc": executable file not found in $PATH

文章目录

    执行 golang 测试代码时,报错:

    > go test
    # runtime/cgo
    exec: "gcc": executable file not found in $PATH
    

    开发环境,Windows 10 WSL - Ubuntu

    解决方法

    sudo apt update
    sudo apt-get install build-essential
    

    再次执行 go test 就正常了。