21 lines
784 B
Markdown
21 lines
784 B
Markdown
# Correct Way to Run the Go Server
|
|
|
|
The error occurs because you are running `go run .\main.go`.
|
|
|
|
In Go, `go run file.go` **only compiles that specific file**. However, your `main` package is now split across multiple files:
|
|
- `main.go` (Main entry point)
|
|
- `handlers_runner.go` (Contains `runCode`)
|
|
- `handlers_rbac.go` (Contains `adminGetPermissions`, `adminUpdateRolePermissions`)
|
|
|
|
When you run only `main.go`, the compiler cannot see the functions defined in the other files, causing "undefined" errors.
|
|
|
|
## Solution
|
|
|
|
Please run the following command in the `server` directory instead:
|
|
|
|
```powershell
|
|
go run .
|
|
```
|
|
|
|
This command tells Go to compile **all files** in the current package directory, which will successfully link `runCode`, `adminGetPermissions`, and other functions.
|