Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit205b619

Browse files
feat: upgrade golangci-lint to v2 (#386)
Co-authored-by: William Martin <williammartin@github.com>
1 parent2d6e3dd commit205b619

File tree

7 files changed

+41
-22
lines changed

7 files changed

+41
-22
lines changed

‎.github/workflows/lint.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
go mod verify
2525
go mod download
2626
27-
LINT_VERSION=1.64.8
27+
LINT_VERSION=2.1.6
2828
curl -fsSL https://github.com/golangci/golangci-lint/releases/download/v${LINT_VERSION}/golangci-lint-${LINT_VERSION}-linux-amd64.tar.gz | \
2929
tar xz --strip-components 1 --wildcards \*/golangci-lint
3030
mkdir -p bin && mv golangci-lint bin/
@@ -45,6 +45,6 @@ jobs:
4545
assert-nothing-changed go fmt ./...
4646
assert-nothing-changed go mod tidy
4747
48-
bin/golangci-lint run --out-format=colored-line-number --timeout=3m || STATUS=$?
48+
bin/golangci-lint run --timeout=3m || STATUS=$?
4949
5050
exit $STATUS

‎.golangci.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# https://golangci-lint.run/usage/configuration
2+
version:"2"
3+
14
run:
25
timeout:5m
36
tests:true
@@ -8,21 +11,37 @@ linters:
811
-govet
912
-errcheck
1013
-staticcheck
11-
-gofmt
12-
-goimports
1314
-revive
1415
-ineffassign
15-
-typecheck
1616
-unused
17-
-gosimple
1817
-misspell
1918
-nakedret
2019
-bodyclose
2120
-gocritic
2221
-makezero
2322
-gosec
23+
settings:
24+
staticcheck:
25+
checks:
26+
-all
27+
-'-QF1008'# Allow embedded structs to be referenced by field
28+
-'-ST1000'# Do not require package comments
29+
revive:
30+
rules:
31+
-name:exported
32+
disabled:true
33+
-name:exported
34+
disabled:true
35+
-name:package-comments
36+
disabled:true
37+
38+
formatters:
39+
enable:
40+
-gofmt
41+
-goimports
2442

2543
output:
26-
formats:colored-line-number
27-
print-issued-lines:true
28-
print-linter-name:true
44+
formats:
45+
text:
46+
print-linter-name:true
47+
print-issued-lines:true

‎CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Please note that this project is released with a [Contributor Code of Conduct](C
1515
These are one time installations required to be able to test your changes locally as part of the pull request (PR) submission process.
1616

1717
1. install Go[through download](https://go.dev/doc/install) |[through Homebrew](https://formulae.brew.sh/formula/go)
18-
1.[install golangci-lint](https://golangci-lint.run/welcome/install/#local-installation)
18+
1.[install golangci-lint v2](https://golangci-lint.run/welcome/install/#local-installation)
1919

2020
##Submitting a pull request
2121

‎cmd/mcpcurl/main.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ type (
7777
Argumentsmap[string]interface{}`json:"arguments"`
7878
}
7979

80-
//Define structure to matchthe response format
80+
//Content matchesthe response format of a text content response
8181
Contentstruct {
8282
Typestring`json:"type"`
8383
Textstring`json:"text"`
@@ -284,10 +284,10 @@ func addCommandFromTool(toolsCmd *cobra.Command, tool *Tool, prettyPrint bool) {
284284
cmd.Flags().Bool(name,false,description)
285285
case"array":
286286
ifprop.Items!=nil {
287-
ifprop.Items.Type=="string" {
287+
switchprop.Items.Type {
288+
case"string":
288289
cmd.Flags().StringSlice(name, []string{},description)
289-
}elseifprop.Items.Type=="object" {
290-
// For complex objects in arrays, we'll use a JSON string that users can provide
290+
case"object":
291291
cmd.Flags().String(name+"-json","",description+" (provide as JSON array)")
292292
}
293293
}
@@ -327,11 +327,12 @@ func buildArgumentsMap(cmd *cobra.Command, tool *Tool) (map[string]interface{},
327327
}
328328
case"array":
329329
ifprop.Items!=nil {
330-
ifprop.Items.Type=="string" {
330+
switchprop.Items.Type {
331+
case"string":
331332
ifvalues,_:=cmd.Flags().GetStringSlice(name);len(values)>0 {
332333
arguments[name]=values
333334
}
334-
}elseifprop.Items.Type=="object" {
335+
case"object":
335336
ifjsonStr,_:=cmd.Flags().GetString(name+"-json");jsonStr!="" {
336337
varjsonArray []interface{}
337338
iferr:=json.Unmarshal([]byte(jsonStr),&jsonArray);err!=nil {

‎internal/ghmcp/server.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/github/github-mcp-server/pkg/translations"
1515
gogithub"github.com/google/go-github/v69/github"
1616
"github.com/mark3labs/mcp-go/mcp"
17-
1817
"github.com/mark3labs/mcp-go/server"
1918
"github.com/sirupsen/logrus"
2019
)
@@ -170,7 +169,7 @@ func RunStdioServer(cfg StdioServerConfig) error {
170169

171170
logrusLogger:=logrus.New()
172171
ifcfg.LogFilePath!="" {
173-
file,err:=os.OpenFile(cfg.LogFilePath,os.O_CREATE|os.O_WRONLY|os.O_APPEND,0666)
172+
file,err:=os.OpenFile(cfg.LogFilePath,os.O_CREATE|os.O_WRONLY|os.O_APPEND,0600)
174173
iferr!=nil {
175174
returnfmt.Errorf("failed to open log file: %w",err)
176175
}

‎pkg/github/repositories.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ func CreateBranch(getClient GetClientFn, t translations.TranslationHelperFunc) (
612612
iferr!=nil {
613613
returnnil,fmt.Errorf("failed to get repository: %w",err)
614614
}
615-
deferresp.Body.Close()
615+
deferfunc() {_=resp.Body.Close() }()
616616

617617
fromBranch=*repository.DefaultBranch
618618
}
@@ -622,7 +622,7 @@ func CreateBranch(getClient GetClientFn, t translations.TranslationHelperFunc) (
622622
iferr!=nil {
623623
returnnil,fmt.Errorf("failed to get reference: %w",err)
624624
}
625-
deferresp.Body.Close()
625+
deferfunc() {_=resp.Body.Close() }()
626626

627627
// Create new branch
628628
newRef:=&github.Reference{
@@ -634,7 +634,7 @@ func CreateBranch(getClient GetClientFn, t translations.TranslationHelperFunc) (
634634
iferr!=nil {
635635
returnnil,fmt.Errorf("failed to create branch: %w",err)
636636
}
637-
deferresp.Body.Close()
637+
deferfunc() {_=resp.Body.Close() }()
638638

639639
r,err:=json.Marshal(createdRef)
640640
iferr!=nil {

‎pkg/translations/translations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func TranslationHelper() (TranslationHelperFunc, func()) {
5656
}
5757
}
5858

59-
//dump translationKeyMap to a json file called github-mcp-server-config.json
59+
//DumpTranslationKeyMap writes the translation map to a json file called github-mcp-server-config.json
6060
funcDumpTranslationKeyMap(translationKeyMapmap[string]string)error {
6161
file,err:=os.Create("github-mcp-server-config.json")
6262
iferr!=nil {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp