Skip to content

Commit 153ad33

Browse files
authored
feat: fix linter deprecation warnings (#123)
1 parent 7f40900 commit 153ad33

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

.golangci.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ linters:
1616
- gocyclo
1717
- gofmt
1818
- goimports
19-
- gomnd
19+
- mnd
2020
- gosec
2121
- gosimple
2222
- govet
@@ -27,6 +27,7 @@ linters:
2727
- nakedret
2828
- nestif
2929
- nilerr
30+
- nolintlint
3031
- prealloc
3132
- revive
3233
- staticcheck
@@ -42,7 +43,9 @@ linters-settings:
4243
min-len: 2
4344
min-occurrences: 2
4445
govet:
45-
check-shadowing: true
46+
enable-all: true
47+
disable:
48+
- fieldalignment
4649
lll:
4750
line-length: 120
4851
tab-width: 4

generator/main.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const (
6767
queryParamArraySize = 2
6868
)
6969

70-
// nolint:funlen,gocognit,gocyclo // It's a generator, it's supposed to be long, and we won't expand it.
70+
//nolint:funlen,gocognit,gocyclo // It's a generator, it's supposed to be long, and we won't expand it.
7171
func exec() error {
7272
cfg := new(envConfig)
7373

@@ -422,15 +422,14 @@ func exec() error {
422422
for _, k := range sortedKeys(scope) {
423423
v := scope[k]
424424
err = writeStruct(file, v)
425-
426425
if err != nil {
427426
return err
428427
}
429428
}
430429

431430
dirPath := filepath.Join(cfg.HandlerDir, fileName)
432431

433-
err = os.MkdirAll(dirPath, os.ModePerm)
432+
err = os.MkdirAll(dirPath, dirMode)
434433
if err != nil {
435434
return err
436435
}
@@ -463,9 +462,8 @@ func exec() error {
463462
// reMakesSense sometimes there are invalid enums, for instance just a comma ","
464463
var reMakesSense = regexp.MustCompile(`\w`)
465464

466-
// nolint:funlen // It's a generator, it's supposed to be long, and we won't expand it.
465+
//nolint:funlen // It's a generator, it's supposed to be long, and we won't expand it.
467466
func writeStruct(f *jen.File, s *Schema) error {
468-
// nolint:nestif // It's a generator, it's supposed to be long, and we won't expand it.
469467
if s.isEnum() {
470468
kind := getScalarType(s)
471469
o := f.Type().Id(s.CamelName)
@@ -563,7 +561,8 @@ func toSingle(src string) string {
563561

564562
const (
565563
yamlTabSize = 2
566-
writeMode = os.FileMode(0644)
564+
writeMode = os.FileMode(0o644)
565+
dirMode = os.FileMode(0o750)
567566
)
568567

569568
// readConfig reads and formats the config

generator/models.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ type Schema struct {
151151
in, out bool // Request or Response DTO
152152
}
153153

154-
// nolint:funlen,gocognit,gocyclo // It is easy to maintain and read, we don't need to split it
154+
//nolint:funlen,gocognit,gocyclo // It is easy to maintain and read, we don't need to split it
155155
func (s *Schema) init(doc *Doc, scope map[string]*Schema, name string) {
156156
if s.Ref != "" {
157157
other, err := doc.getSchema(s.Ref)

0 commit comments

Comments
 (0)