嘿!我目前正在学习 Go Lang,我正在对我的概念做一些基本的笔记,尽管我也只是将它们发布在这里。它们没有经过深思熟虑或写得很好,但只是我时不时做笔记以供参考。
我正在学习 Maximilian Schwarzmüller 的 Udemy 课程,
package fileops import ( "errors" "fmt" "os" "strconv" ) func writeFloatToFile(value float64, fileName string) { valueText := fmt.Sprint(value) os.WriteFile(fileName, []byte(valueText), 0644) }
package main import ( "fmt" "example.com/bank/fileops" )
package fileops import ( "errors" "fmt" "os" "strconv" ) func writeFloatToFile(value float64, fileName string) { valueText := fmt.Sprint(value) os.WriteFile(fileName, []byte(valueText), 0644) }
package main import ( "fmt" "example.com/bank/fileops" )
func WriteFloatToFile(value float64, fileName string) {} func GetFLoatFromFile(fileName string) (float64, error) {}
package main import ( "fmt" "example.com/bank/fileops" ) fileops.WriteFloatToFile(accountBalance, accountBalanceFile)
go get github.com/Pallinder/go-randomdata
module example.com/bank go 1.22.1 require github.com/Pallinder/go-randomdata v1.2.0 // indirect
以上是学习 GO : - 包的详细内容。更多信息请关注PHP中文网其他相关文章!