go run <dir> works now too and pulls in all the files in the package at <dir> so "go run ." is a nice shortcut that works more like the other subcommands of the go tool.
On Thursday, October 24, 2019 at 8:17:54 AM UTC-4, Guy Allard wrote: > > Use: > > go run *.go > > or > > go build *.go > > > On Wednesday, October 23, 2019 at 1:20:26 AM UTC-4, Cam wrote: >> >> Hi everyone on Golang group, >> >> I'm having difficulty with some simple code, and appreciate if someone >> can point out a solution. >> >> There is a simple main package that looks like this: >> >> github.com/username/playground/ >> hello.go >> main.go >> >> hello.go: >> >> package main >> import "fmt" >> func SayHello() { >> fmt.Println("Hello") >> } >> >> main.go >> >> package main >> func main() { >> SayHello() >> } >> >> Trying to run main.go is producing an error: >> >> # command-line-arguments >> go/src/github.com/username/playground/main.go:4:2: undefined: SayHello >> >> Why is this error happening? Is my packaging done wrong? >> >> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/2266cc30-053b-49ef-9418-fc24ecf9fe4d%40googlegroups.com.