It is recommended that there is only one entry file for main.go under the golang main package
When there are other go files, and functions are defined in other go files
This function is called in the main.go entry file, go run main.go is executed, it will prompt undefined
If you have to do this, then all files must be added when go run, otherwise only the main.go file will be loaded by default
Only files in the non-main package will be automatically loaded through dependencies. So you need to enter multiple files as parameters
Should use go run a.go b.go c.go or go run *.go to run, compile the same
Read More:
- [Solved] Golang Error: main.go:5:2: package go_code/chapter10/factory/model is not in GOROOT
- [Solved] .\main.go:3:6: missing function body .\main.go:4:1: syntax error: unexpected semicolon or newline be
- Go Language Error: main redeclared in this block [How to Solve]
- Go declares that the local variable does not use command line arguments. Main. Go: 4:6: a declared but not used
- package golang.org/x/net/XXX: unrecognized import path “golang.org/x/net/xxx“…
- Golang Error: go get github/xxx [How to Fix]
- [Solved] cannot find package “go.opentelemetry.io/otel/api/trace“ in any of
- [Solved] Sparksql error: Exception in thread “main” org.apache.spark.sql.catalyst.errors.package$TreeNodeException
- An error was reported when Maven package was running the packaged jar package: there is no main list attribute in xxx.jar, which can be solved by configuring Maven plugin
- [Solved] UE4 Error: Couldn‘t find file for package *** requested by async loading code. NameToLoad: ***
- Docker Create tomcat Error standard_init_linux.go:211: exec user process caused “no such file or directory”
- GCC Error:(.text+0x24): undefined reference to `main‘collect2: error: ld returned 1 exit status [Solved]
- Vue Error reported after introduction of path: Already included file name ‘××ב differs from file name ‘××ב only in casing.
- [Solved] Error running ‘go build myfir_go_project‘: Cannot run program
- Go build package error: TARGET_OS_MAC & IOMasterPort
- [Solved] VScode Error: build constraints exclude all Go files in syscall\js
- [Solved] Could not find a package configuration file provided by “moveit_core“
- How to Solve golang test Error: # command-line-arguments [command-line-arguments.test]
- VSCode Unable to find custom header file directory: fatal error: no such file or directory