How to properly organize the structure of a multi-file Go project?
Hello everyone! I recently started learning Go, and I ran into a problem organizing a project that consists of multiple files.
I wrote a small console application for task management (todo list). In one file main.go, I have all the code: input handling, logic, and file operations. When the project grew to 500 lines, it became very inconvenient to navigate.
I tried to split the code into several files, but I couldn't get it to work. For example, I created a `tasks` folder, put a `tasks.go` file there with functions for working with tasks, and in `main.go` I try to call them. But the compiler complains that the functions are not defined.
Here is an example of my code:
```go
// main.go
package main
func main() {
task := CreateTask("Buy milk") // Error: undefined: CreateTask
```
No answers yet.
Log in to leave an answer