我有一个hello包含文件go.mod和hello.go的包,以及一个say_things包含文件go.mod和say_things.go.
hello.go:
package main
import "github.com/user/say_things"
func main() {
say_things.SayBye()
}
say_things.go:
package say_things
import "fmt"
func SayBye() {
fmt.Println("BYE")
}
这两个项目都是 github 项目。当我运行时hello.go,它会按预期打印“BYE”。我现在更新SayBye为:
package say_things
import "fmt"
func SayBye() {
fmt.Println("GO AWAY")
}
并将更改推送到 github。我再次跑hello.go,期待它说“走开”,但事实并非如此。它仍然说BYE。我再次删除go.sum生成的go run hello.go,但仍然显示BYE. 然后我去go/pkg/mod/github.com/user/并删除say_bye@v0.0.0-<hash>,然后hello.go再次运行。尽管如此,什么都没有改变。接下来,我运行go get github.com/user/say_things,我仍然得到BYE。
如何hello.go运行更新的say_hello代码?
呼如林
皈依舞
守候你守候我
随时随地看视频慕课网APP
相关分类