使用三方提供的包
我们在pkg.go.dev这个网站上查找需要的包,将一下代码写道hello.go
代码语言:txt复制package main
import "fmt"
import "rsc.io/quote"
func main() {
fmt.Println(quote.Go())
}
执行 go mod tidy将依赖包导入
代码语言:txt复制D:gohello>go mod tidy
go: finding module for package rsc.io/quote
go: found rsc.io/quote in rsc.io/quote v1.5.2
执行
代码语言:txt复制D:gohello>go run .
Don't communicate by sharing memory, share memory by communicating.