ok that gets rid of the other error, but now im getting this:
{"level":"fatal","ts":"2022-11-17T19:13:50.085Z","caller":"server/runtime_go.go:2628","msg":"Error reading InitModule function in Go module","name":"backend"}
here’s the code that sets up the module:
package main
import (
"context"
"database/sql"
"encoding/json"
"time"
"github.com/heroiclabs/nakama-common/runtime"
)
func InitModule(ctx context.Context, logger runtime.Logger, db *sql.DB, iz runtime.Initializer) error {
initStart := time.Now()
if err := iz.RegisterRpc("health", RpcHealthCheck); err != nil {
return err
}
logger.Info("module loaded in %ms", time.Since(initStart).Milliseconds())
return nil
}
type HealthCheckResponse struct {
Success bool `json:"success"`
}
func RpcHealthCheck(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, payload string) (string, error) {
logger.Debug("Healthcheck RPC called")
response := &HealthCheckResponse{Success: true}
out, err := json.Marshal(response)
if err != nil {
logger.Error("cannot marshal response: %w", err)
return "", runtime.NewError("cannot marshal response", 13)
}
return string(out), nil
}