go 包的概念

it2022-05-05  106

------------------------------------------------------------------

package main

import ( "fmt" "math/rand")

func main() { fmt.Println("My favorite number is", rand.Intn(10))}

------------------------------------------------------------------

导入包 使用 import 

math/rand 为导入的包

math为路径  rand 是包名

在 rand.Intn(10)上 按下F12 或 ctrl+鼠标左键 跳转到 gaiintn方法的实现上 ,查看该方法所在的包

 

go语言开发交流qq群 857263711

保持进步希望每个人都能找到自己喜欢的方式生活、工作。

转载于:https://www.cnblogs.com/songhuan999999/p/11184397.html


最新回复(0)