fix: goimports — strip unused imports from all server files
CI / Lint (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Build (push) Has been cancelled

This commit is contained in:
2026-04-26 15:00:04 -04:00
parent e598150d90
commit 5e0c10db01
9 changed files with 14 additions and 39 deletions
-3
View File
@@ -1,14 +1,12 @@
package server
import (
"database/sql"
"fmt"
"net/http"
"strings"
"time"
"github.com/gin-gonic/gin"
"gophergate/internal/db"
)
type UsagePeriodFilter struct {
@@ -372,4 +370,3 @@ func (s *Server) handleDetailedUsage(c *gin.Context) {
c.JSON(http.StatusOK, SuccessResponse(results))
}
+2 -4
View File
@@ -2,14 +2,13 @@ package server
import (
"database/sql"
"fmt"
"net/http"
"strings"
"time"
"gophergate/internal/db"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
"gophergate/internal/db"
)
func (s *Server) handleGetClients(c *gin.Context) {
@@ -272,4 +271,3 @@ func (s *Server) handleDeleteClientToken(c *gin.Context) {
c.JSON(http.StatusOK, SuccessResponse(gin.H{"message": "Token revoked"}))
}
+1 -6
View File
@@ -1,18 +1,14 @@
package server
import (
"database/sql"
"fmt"
"net/http"
"strings"
"time"
"log/slog"
"gophergate/internal/db"
"github.com/gin-gonic/gin"
"golang.org/x/crypto/bcrypt"
"gophergate/internal/db"
"gophergate/internal/utils"
)
type ApiResponse struct {
@@ -166,4 +162,3 @@ func (s *Server) handleLogout(c *gin.Context) {
}
c.JSON(http.StatusOK, SuccessResponse(gin.H{"message": "Logged out"}))
}
+4 -4
View File
@@ -72,7 +72,7 @@ func (l *RequestLogger) processLog(entry RequestLog) {
defer tx.Rollback()
// Ensure client exists
_, _ = tx.Exec("INSERT OR IGNORE INTO clients (client_id, name, description) VALUES (?, ?, 'Auto-created from request')",
_, _ = tx.Exec("INSERT OR IGNORE INTO clients (client_id, name, description) VALUES (?, ?, 'Auto-created from request')",
entry.ClientID, entry.ClientID)
// Insert log
@@ -80,9 +80,9 @@ func (l *RequestLogger) processLog(entry RequestLog) {
INSERT INTO llm_requests
(timestamp, client_id, provider, model, prompt_tokens, completion_tokens, reasoning_tokens, total_tokens, cache_read_tokens, cache_write_tokens, cost, has_images, status, error_message, duration_ms)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`, entry.Timestamp, entry.ClientID, entry.Provider, entry.Model,
entry.PromptTokens, entry.CompletionTokens, entry.ReasoningTokens, entry.TotalTokens,
entry.CacheReadTokens, entry.CacheWriteTokens, entry.Cost, entry.HasImages,
`, entry.Timestamp, entry.ClientID, entry.Provider, entry.Model,
entry.PromptTokens, entry.CompletionTokens, entry.ReasoningTokens, entry.TotalTokens,
entry.CacheReadTokens, entry.CacheWriteTokens, entry.Cost, entry.HasImages,
entry.Status, entry.ErrorMessage, entry.DurationMS)
if err != nil {
+1 -8
View File
@@ -3,16 +3,10 @@ package server
import (
"fmt"
"net/http"
"strings"
"time"
"log/slog"
"gophergate/internal/db"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
"gophergate/internal/db"
"gophergate/internal/models"
"gophergate/internal/utils"
)
func (s *Server) handleGetModels(c *gin.Context) {
@@ -234,4 +228,3 @@ func (s *Server) handleUpdateModel(c *gin.Context) {
c.JSON(http.StatusOK, SuccessResponse(gin.H{"message": "Model updated"}))
}
+3 -4
View File
@@ -1,17 +1,17 @@
package server
import (
"database/sql"
"fmt"
"net/http"
"strings"
"time"
"log/slog"
"github.com/gin-gonic/gin"
"gophergate/internal/db"
"gophergate/internal/models"
"gophergate/internal/utils"
"github.com/gin-gonic/gin"
)
func (s *Server) handleGetProviders(c *gin.Context) {
@@ -240,4 +240,3 @@ func (s *Server) handleTestProvider(c *gin.Context) {
"latency": latency,
}))
}
-1
View File
@@ -12,7 +12,6 @@ import (
"gophergate/internal/config"
"gophergate/internal/db"
"gophergate/internal/middleware"
"log/slog"
"gophergate/internal/models"
"gophergate/internal/providers"
"gophergate/internal/utils"
+1 -4
View File
@@ -4,14 +4,11 @@ import (
"fmt"
"net/http"
"os"
"strings"
"time"
"log/slog"
"gophergate/internal/db"
"github.com/gin-gonic/gin"
"gophergate/internal/db"
"gophergate/internal/utils"
"github.com/shirou/gopsutil/v3/cpu"
"github.com/shirou/gopsutil/v3/disk"
+2 -5
View File
@@ -1,14 +1,12 @@
package server
import (
"fmt"
"net/http"
"strings"
"time"
"gophergate/internal/db"
"github.com/gin-gonic/gin"
"golang.org/x/crypto/bcrypt"
"gophergate/internal/db"
)
func (s *Server) handleGetUsers(c *gin.Context) {
@@ -109,4 +107,3 @@ func (s *Server) handleDeleteUser(c *gin.Context) {
c.JSON(http.StatusOK, SuccessResponse(gin.H{"message": "User deleted"}))
}