refactor: rename internal/log to internal/logging to avoid stdlib

shadowing

- refactor: rename `internal/log` → `internal/logging`, package `log` →
  `logging`
- refactor: update imports in `cmd/serve.go` and
  `internal/middleware/requestid.go`
This commit is contained in:
2026-07-06 00:11:06 +08:00
parent 3ad61244dc
commit 803f195af1
4 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ import (
"github.com/dhao2001/mygo/internal/app"
"github.com/dhao2001/mygo/internal/config"
mygolog "github.com/dhao2001/mygo/internal/log"
"github.com/dhao2001/mygo/internal/logging"
"github.com/dhao2001/mygo/internal/server"
)
@@ -29,7 +29,7 @@ var serveCmd = &cobra.Command{
}
// Set up structured logging before anything else.
appLogger := mygolog.NewLogger(cfg.Log)
appLogger := logging.NewLogger(cfg.Log)
slog.SetDefault(appLogger)
slog.Info("mygo server starting")
if loadInfo.EphemeralJWTSecret {
@@ -1,4 +1,4 @@
package log
package logging
import (
"context"
@@ -1,4 +1,4 @@
package log
package logging
import (
"context"
+2 -2
View File
@@ -4,7 +4,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/google/uuid"
mygolog "github.com/dhao2001/mygo/internal/log"
"github.com/dhao2001/mygo/internal/logging"
)
// RequestID returns a Gin middleware that ensures every request has a
@@ -19,7 +19,7 @@ func RequestID() gin.HandlerFunc {
}
// Inject into Go context for slog.*Context calls.
c.Request = c.Request.WithContext(mygolog.WithRequestID(c.Request.Context(), reqID))
c.Request = c.Request.WithContext(logging.WithRequestID(c.Request.Context(), reqID))
// Also set in Gin context for direct access.
c.Set("req_id", reqID)