Skip to content

Commit 311ec25

Browse files
committed
Upgrade to golang 1.22
- Upgrade swag - Upgrade golangci-lint - Upgrade packages
1 parent 2550f6b commit 311ec25

File tree

630 files changed

+70177
-114198
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

630 files changed

+70177
-114198
lines changed

.golangci.yml

+6
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,11 @@ linters:
55
enable:
66
- revive
77
- gofmt
8+
linters-settings:
9+
revive:
10+
# severity: warning
11+
rules:
12+
- name: package-comments
13+
disabled: true
814
issues:
915
exclude-use-default: false

Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
help: ## Prints help (only for targets with comments)
33
@grep -E '^[a-zA-Z._-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
44

5-
GO111MODULE=on
65
APP=dobby
76
VERSION?=1.0
87
APP_EXECUTABLE="./out/$(APP)"
98
SRC_PACKAGES=$(shell go list ./... | grep -v "vendor")
109
SHELL=/bin/bash -o pipefail
10+
GOPATH=$(shell go env GOPATH)
1111

1212
ifeq ($(GOMETA_LINT),)
1313
GOMETA_LINT=$(shell command -v $(PWD)/bin/golangci-lint 2> /dev/null)
@@ -33,7 +33,7 @@ else
3333
endif
3434

3535
GOLANGCI_LINT=$(shell command -v golangci-lint 2> /dev/null)
36-
GOLANGCI_LINT_VERSION=v1.41.1
36+
GOLANGCI_LINT_VERSION=v1.59.1
3737
ifeq ($(GOLANGCI_LINT),)
3838
GOLANGCI_LINT=$(shell command -v $(PWD)/bin/golangci-lint 2> /dev/null)
3939
endif
@@ -44,18 +44,18 @@ endif
4444

4545
setup-richgo:
4646
ifeq ($(RICHGO),)
47-
GO111MODULE=off $(GO_BINARY) get -u github.com/kyoh86/richgo
47+
$(GO_BINARY) get -u github.com/kyoh86/richgo
4848
endif
4949

5050
setup-golangci-lint:
5151
ifeq ($(GOLANGCI_LINT),)
52-
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s $(GOLANGCI_LINT_VERSION)
52+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin $(GOLANGCI_LINT_VERSION)
5353
endif
5454

5555
SWAG=$(shell command -v swag 2> /dev/null)
5656
setup-swag:
5757
ifeq ($(SWAG),)
58-
GO111MODULE=off $(GO_BINARY) get -u github.com/swaggo/swag/cmd/swag
58+
$(GO_BINARY) install github.com/swaggo/swag/cmd/swag@latest
5959
endif
6060

6161
setup: setup-golangci-lint setup-swag ensure-build-dir ## Setup environment

docs/docs.go

+19-57
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
2-
// This file was generated by swaggo/swag
1+
// Package docs Code generated by swaggo/swag. DO NOT EDIT
32
package docs
43

5-
import (
6-
"bytes"
7-
"encoding/json"
8-
"strings"
9-
"text/template"
4+
import "github.com/swaggo/swag"
105

11-
"github.com/swaggo/swag"
12-
)
13-
14-
var doc = `{
6+
const docTemplate = `{
157
"schemes": {{ marshal .Schemes }},
168
"swagger": "2.0",
179
"info": {
18-
"description": "{{.Description}}",
10+
"description": "{{escape .Description}}",
1911
"title": "{{.Title}}",
2012
"contact": {},
2113
"version": "{{.Version}}"
@@ -66,7 +58,8 @@ var doc = `{
6658
"tags": [
6759
"Control"
6860
],
69-
"summary": "Suicide"
61+
"summary": "Suicide",
62+
"responses": {}
7063
}
7164
},
7265
"/control/goturbo/cpu": {
@@ -485,9 +478,7 @@ var doc = `{
485478
"model.CallRequest": {
486479
"type": "object",
487480
"properties": {
488-
"body": {
489-
"type": "object"
490-
},
481+
"body": {},
491482
"method": {
492483
"type": "string"
493484
},
@@ -555,49 +546,20 @@ var doc = `{
555546
}
556547
}`
557548

558-
type swaggerInfo struct {
559-
Version string
560-
Host string
561-
BasePath string
562-
Schemes []string
563-
Title string
564-
Description string
565-
}
566-
567549
// SwaggerInfo holds exported Swagger Info so clients can modify it
568-
var SwaggerInfo = swaggerInfo{
569-
Version: "",
570-
Host: "",
571-
BasePath: "",
572-
Schemes: []string{},
573-
Title: "",
574-
Description: "",
575-
}
576-
577-
type s struct{}
578-
579-
func (s *s) ReadDoc() string {
580-
sInfo := SwaggerInfo
581-
sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
582-
583-
t, err := template.New("swagger_info").Funcs(template.FuncMap{
584-
"marshal": func(v interface{}) string {
585-
a, _ := json.Marshal(v)
586-
return string(a)
587-
},
588-
}).Parse(doc)
589-
if err != nil {
590-
return doc
591-
}
592-
593-
var tpl bytes.Buffer
594-
if err := t.Execute(&tpl, sInfo); err != nil {
595-
return doc
596-
}
597-
598-
return tpl.String()
550+
var SwaggerInfo = &swag.Spec{
551+
Version: "",
552+
Host: "",
553+
BasePath: "",
554+
Schemes: []string{},
555+
Title: "",
556+
Description: "",
557+
InfoInstanceName: "swagger",
558+
SwaggerTemplate: docTemplate,
559+
LeftDelim: "{{",
560+
RightDelim: "}}",
599561
}
600562

601563
func init() {
602-
swag.Register(swag.Name, &s{})
564+
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
603565
}

docs/swagger.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
"tags": [
4848
"Control"
4949
],
50-
"summary": "Suicide"
50+
"summary": "Suicide",
51+
"responses": {}
5152
}
5253
},
5354
"/control/goturbo/cpu": {
@@ -466,9 +467,7 @@
466467
"model.CallRequest": {
467468
"type": "object",
468469
"properties": {
469-
"body": {
470-
"type": "object"
471-
},
470+
"body": {},
472471
"method": {
473472
"type": "string"
474473
},

docs/swagger.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ definitions:
1717
type: object
1818
model.CallRequest:
1919
properties:
20-
body:
21-
type: object
20+
body: {}
2221
method:
2322
type: string
2423
url:
@@ -94,6 +93,7 @@ paths:
9493
consumes:
9594
- application/json
9695
description: Make Dobby kill itself
96+
responses: {}
9797
summary: Suicide
9898
tags:
9999
- Control

go.mod

+34-14
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,46 @@
11
module github.com/thecasualcoder/dobby
22

3-
go 1.14
3+
go 1.22
44

55
require (
6-
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
76
github.com/gin-gonic/gin v1.7.2
8-
github.com/go-openapi/jsonreference v0.19.6 // indirect
9-
github.com/go-openapi/spec v0.20.3 // indirect
10-
github.com/go-openapi/swag v0.19.15 // indirect
11-
github.com/go-playground/validator/v10 v10.8.0 // indirect
127
github.com/golang/mock v1.4.3
8+
github.com/stretchr/testify v1.9.0
9+
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14
10+
github.com/swaggo/gin-swagger v1.3.0
11+
github.com/swaggo/swag v1.16.3
12+
github.com/urfave/cli v1.22.5
13+
)
14+
15+
require (
16+
github.com/KyleBanks/depth v1.2.1 // indirect
17+
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
18+
github.com/davecgh/go-spew v1.1.1 // indirect
19+
github.com/gin-contrib/sse v0.1.0 // indirect
20+
github.com/go-openapi/jsonpointer v0.21.0 // indirect
21+
github.com/go-openapi/jsonreference v0.21.0 // indirect
22+
github.com/go-openapi/spec v0.21.0 // indirect
23+
github.com/go-openapi/swag v0.23.0 // indirect
24+
github.com/go-playground/locales v0.13.0 // indirect
25+
github.com/go-playground/universal-translator v0.17.0 // indirect
26+
github.com/go-playground/validator/v10 v10.8.0 // indirect
1327
github.com/golang/protobuf v1.5.2 // indirect
28+
github.com/josharian/intern v1.0.0 // indirect
1429
github.com/json-iterator/go v1.1.11 // indirect
30+
github.com/leodido/go-urn v1.2.1 // indirect
1531
github.com/mailru/easyjson v0.7.7 // indirect
1632
github.com/mattn/go-isatty v0.0.13 // indirect
17-
github.com/stretchr/testify v1.6.1
18-
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14
19-
github.com/swaggo/gin-swagger v1.3.0
20-
github.com/swaggo/swag v1.7.0
21-
github.com/ugorji/go v1.2.6 // indirect
22-
github.com/urfave/cli v1.22.5
23-
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985 // indirect
24-
golang.org/x/tools v0.1.5 // indirect
33+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
34+
github.com/modern-go/reflect2 v1.0.1 // indirect
35+
github.com/pmezard/go-difflib v1.0.0 // indirect
36+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
37+
github.com/ugorji/go/codec v1.2.6 // indirect
38+
golang.org/x/crypto v0.25.0 // indirect
39+
golang.org/x/net v0.27.0 // indirect
40+
golang.org/x/sys v0.22.0 // indirect
41+
golang.org/x/text v0.16.0 // indirect
42+
golang.org/x/tools v0.23.0 // indirect
2543
google.golang.org/protobuf v1.27.1 // indirect
44+
gopkg.in/yaml.v2 v2.4.0 // indirect
45+
gopkg.in/yaml.v3 v3.0.1 // indirect
2646
)

0 commit comments

Comments
 (0)