Skip to content

Commit 1956281

Browse files
committed
Merge branch 'main' into fix-lint-and-test
2 parents 7c2294d + 9c222aa commit 1956281

File tree

24 files changed

+454
-37
lines changed

24 files changed

+454
-37
lines changed

.github/workflows/golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ jobs:
1010
- name: golangci-lint
1111
uses: golangci/golangci-lint-action@v2
1212
with:
13-
version: v1.36
13+
version: v1.49

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
#internal/dist/openapi.yaml
44
testing_out.yaml
55
./testing_out.yaml
6-
internal/dist/openapi.yaml
6+
internal/dist/openapi.yaml
7+
.vscode

.golangci.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@ linters-settings:
88
- style
99
goimports:
1010
local-prefixes: github.com/golangci/golangci-lint
11-
golint:
12-
min-confidence: 0
1311
govet:
1412
check-shadowing: true
15-
maligned:
16-
suggest-new: true
1713
misspell:
1814
locale: US
1915
nakedret:
@@ -25,7 +21,6 @@ linters:
2521
disable-all: true
2622
enable:
2723
- bodyclose
28-
- deadcode
2924
- depguard
3025
- dogsled
3126
- dupl
@@ -40,30 +35,25 @@ linters:
4035
- godot
4136
- gofmt
4237
- goimports
43-
- golint
4438
- gomnd
4539
- gomodguard
4640
- goprintffuncname
4741
- gosec
4842
- gosimple
4943
- govet
5044
- ineffassign
51-
- interfacer
5245
- lll
53-
- maligned
5446
- misspell
5547
- nakedret
5648
- nestif
5749
- prealloc
5850
- rowserrcheck
5951
- staticcheck
60-
- structcheck
6152
- stylecheck
6253
- typecheck
6354
- unconvert
6455
- unparam
6556
- unused
66-
- varcheck
6757
- whitespace
6858
- wsl
6959
- asciicheck

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
lint:
22
gofumpt -w -s ./..
3-
golint ./...
43
golangci-lint run --fix
54

65
test:

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ other parts of the system for that matter.
119119
To run examples, and checkout hosted documentation via Swagger UI, issue the following command:
120120
121121
```sh
122-
$ go run ./examples/*.go
122+
$ go run ./examples/file_output/*.go
123+
# or uncomment line 40 and comment line 38 in internal/dist/index.html before running:
124+
$ go run ./examples/stream_output/*.go
123125
```
124126
125127
And navigate to `http://localhost:3005/docs/api/` in case that you didn't change anything before running the example

annotations.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ type (
2626
// MapAnnotationsInPath scanIn is relevant from initiator calling it.
2727
//
2828
// It accepts the path in which to scan for annotations within Go files.
29-
func (o *OAS) MapAnnotationsInPath(scanIn string, conf ...configAnnotation) error {
29+
func (oas *OAS) MapAnnotationsInPath(scanIn string, conf ...configAnnotation) error {
3030
filesInPath, err := scanForChangesInPath(scanIn, getWDFn(conf), walkFilepath)
3131
if err != nil {
3232
return fmt.Errorf(" :%w", err)
3333
}
3434

3535
for _, file := range filesInPath {
36-
err = o.mapDocAnnotations(file)
36+
err = oas.mapDocAnnotations(file)
3737
if err != nil {
3838
return fmt.Errorf(" :%w", err)
3939
}
@@ -103,8 +103,8 @@ func walkFilepath(pathToTraverse string, walker walkerFn) ([]string, error) {
103103
return files, nil
104104
}
105105

106-
func (o *OAS) mapDocAnnotations(path string) error {
107-
if o == nil {
106+
func (oas *OAS) mapDocAnnotations(path string) error {
107+
if oas == nil {
108108
return errors.New("pointer to OASHandlers can not be nil")
109109
}
110110

@@ -119,7 +119,7 @@ func (o *OAS) mapDocAnnotations(path string) error {
119119
line := 1
120120

121121
for scanner.Scan() {
122-
mapIfLineContainsOASTag(scanner.Text(), o)
122+
mapIfLineContainsOASTag(scanner.Text(), oas)
123123
line++
124124
}
125125

build.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ func (oas *OAS) BuildStream(w io.Writer) error {
6464
if err != nil {
6565
return fmt.Errorf("writing issue occurred: %w", err)
6666
}
67-
6867
return nil
6968
}
7069

caller.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
const routePostfix = "Route"
99

1010
// Call is used init registered functions that already exist in the *OAS, and return results if there are any.
11-
func (o *OAS) Call(name string, params ...interface{}) (result []reflect.Value) {
12-
f := reflect.ValueOf(o.RegisteredRoutes[name])
11+
func (oas *OAS) Call(name string, params ...interface{}) (result []reflect.Value) {
12+
f := reflect.ValueOf(oas.RegisteredRoutes[name])
1313

1414
in := make([]reflect.Value, len(params))
1515
for k, param := range params {
@@ -21,8 +21,8 @@ func (o *OAS) Call(name string, params ...interface{}) (result []reflect.Value)
2121
return result
2222
}
2323

24-
func (o *OAS) initCallStackForRoutes() {
25-
for oasPathIndex := range o.Paths {
26-
o.Call(o.Paths[oasPathIndex].HandlerFuncName+routePostfix, oasPathIndex, o)
24+
func (oas *OAS) initCallStackForRoutes() {
25+
for oasPathIndex := range oas.Paths {
26+
oas.Call(oas.Paths[oasPathIndex].HandlerFuncName+routePostfix, oasPathIndex, oas)
2727
}
2828
}

0 commit comments

Comments
 (0)