I split my main.go file into multiple files for organization, but i can't seems to get GoLand to allow me to build it... it errors with something like
.\Main.go:12:5: undefined: functionA
.\Main.go:13:13: undefined: functionB
.\Main.go:13:24: undefined: functionC
**评论:**
dlsniper:
SaturnsVoid:Go to Run | Edit Configurations select the run configuration you created and instead of Run Kind file, use Run Kind package. See: https://youtu.be/ko-wKntCLjg for a visual guide of this. Please note that the linkmode is needed only in special cases, it's entirely optional.
gngeorgiev:thanks! this worked!
kusrabs:I guess you have the files in the same package, next to main.go. In the go build arguments you need to pass all files of the main package. In the cli it would look like
go build *.go
. Should be something like this in goland
dlsniper:Probably function names in another file should start from capital Letter, not letter.
In Go all files in a package (directory) belong to the same package (except for the _test test named packages, in _test.go files). So it doesn't matter how the functions are named.
