代码中获取当前 Go 版本
package main
import (
"fmt"
"runtime"
)
func main() {
// go1.17.5
fmt.Println(runtime.Version())
}
推荐文章: