fix: lint errors - use modules/json, http.MethodPost, remove unused func
This commit is contained in:
@@ -25,7 +25,7 @@ package main
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"code.gitea.io/gitea/modules/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -111,7 +111,7 @@ func main() {
|
||||
func forwardToGitea(request []byte) ([]byte, error) {
|
||||
mcpURL := giteaURL + "/api/v2/mcp"
|
||||
|
||||
req, err := http.NewRequest("POST", mcpURL, bytes.NewReader(request))
|
||||
req, err := http.NewRequest(http.MethodPost, mcpURL, bytes.NewReader(request))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("create request: %w", err)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package v2
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"code.gitea.io/gitea/modules/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -777,16 +777,4 @@ func toolGetRelease(ctx *context.APIContext, args map[string]any) (any, error) {
|
||||
"asset_count": len(assets),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Helper to parse int from interface - unused but kept for future use
|
||||
func getIntArg(args map[string]any, key string) (int64, bool) {
|
||||
if v, ok := args[key].(float64); ok {
|
||||
return int64(v), true
|
||||
}
|
||||
if v, ok := args[key].(string); ok {
|
||||
if i, err := strconv.ParseInt(v, 10, 64); err == nil {
|
||||
return i, true
|
||||
}
|
||||
}
|
||||
return 0, false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user