Go noob, I cannot seem to figure out how to structure my project with packages. What I want is this:
- I want to create a package, lets say its called Dart.
- I have a file called dart.go with package main and the main function in my project directory.
- I have another file, lets call it functions.go in my project directory with 'package dart' as the first line.
- I just want to call functions from functions.go in main, but cannot figure out how to name the packages to get it to build.
- If I put package dart at the top of functions.go it wont build because it finds packages main and dart. I dont want functions.go to be part of another package, I just want one package and the ability to split the functions in this package into multiple files.
- Is this possible in go, or do I have to make multiple packages?
dart.go
package main
import (
...
)
func main () {
...
// call functions declared in functions.go
...
}
functions.go
package dart
import (
...
)
func Function1() {
...
}
func Function2() {
...
}