Skip to content

Commit 0cbed6d

Browse files
committed
Merge main branch and resolve conflicts in file.Close() error handling
2 parents 5ae86ef + b76d146 commit 0cbed6d

11 files changed

Lines changed: 821 additions & 214 deletions

File tree

.github/dependabot.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
open-pull-requests-limit: 10
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
groups:
9+
actions:
10+
update-types:
11+
- "minor"
12+
- "patch"
13+
14+
- package-ecosystem: "gomod"
15+
open-pull-requests-limit: 10
16+
directory: "/"
17+
schedule:
18+
interval: "weekly"
19+
groups:
20+
go-deps:
21+
update-types:
22+
- "minor"
23+
- "patch"

.github/workflows/cicd.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
steps:
2222
- name: Checkout code into go module directory
23-
uses: actions/checkout@v4
23+
uses: actions/checkout@v6
2424
with:
2525
fetch-depth: 0
2626

@@ -48,21 +48,21 @@ jobs:
4848
echo $codeCoverage:
4949
5050
code_quality:
51-
name: 🎖Code Quality️
51+
name: 🎖 Code Quality
5252
runs-on: ubuntu-latest
5353
steps:
5454
- name: Checkout code
55-
uses: actions/checkout@v4
55+
uses: actions/checkout@v6
5656

5757
- name: Set up Go 1.22
5858
uses: actions/setup-go@v5
5959
with:
6060
go-version: 1.22
6161

6262
- name: Install golangci-lint
63-
uses: golangci/golangci-lint-action@v6
63+
uses: golangci/golangci-lint-action@v9
6464
with:
65-
version: v1.59.1
65+
version: v2.4.0
6666
args: --timeout=9m --verbose
6767
env:
6868
GOFLAGS: "-buildvcs=false" # Fix Go 1.22 VCS warnings

.golangci.yml

Lines changed: 133 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,17 @@
1-
---
2-
linters-settings:
3-
dupl:
4-
threshold: 100
5-
exhaustive:
6-
default-signifies-exhaustive: false
7-
funlen:
8-
lines: 100
9-
statements: 50
10-
gci:
11-
sections:
12-
- standard
13-
- default
14-
- localmodule
15-
goconst:
16-
min-len: 2
17-
min-occurrences: 2
18-
gocritic:
19-
enabled-tags:
20-
- diagnostic
21-
- experimental
22-
- opinionated
23-
- performance
24-
- style
25-
disabled-checks:
26-
- dupImport # https://github.com/go-critic/go-critic/issues/845
27-
- ifElseChain
28-
- octalLiteral
29-
- whyNoLint
30-
- wrapperFunc
31-
gocyclo:
32-
min-complexity: 10
33-
goimports:
34-
local-prefixes: github.com/golangci/golangci-lint
35-
mnd:
36-
checks:
37-
- argument
38-
- case
39-
- condition
40-
- return
41-
govet:
42-
enable:
43-
- shadow
44-
settings:
45-
printf:
46-
funcs:
47-
- (gofr.dev/pkg/gofr/Logger).Logf
48-
- (gofr.dev/pkg/gofr/Logger).Errorf
49-
lll:
50-
line-length: 140
51-
misspell:
52-
locale: US
53-
nolintlint:
54-
allow-unused: false # report any unused nolint directives
55-
require-explanation: true # require an explanation for nolint directives
56-
require-specific: true # require nolint directives to be specific about which linter is being skipped
57-
revive:
58-
rules:
59-
# default revive rules, they have to be present otherwise they are disabled
60-
- name: blank-imports
61-
- name: context-as-argument
62-
- name: context-keys-type
63-
- name: dot-imports
64-
- name: empty-block
65-
- name: error-naming
66-
- name: error-return
67-
- name: error-strings
68-
- name: errorf
69-
- name: increment-decrement
70-
- name: indent-error-flow
71-
- name: range
72-
- name: receiver-naming
73-
- name: redefines-builtin-id
74-
- name: superfluous-else
75-
- name: time-naming
76-
- name: unexported-return
77-
- name: unreachable-code
78-
- name: unused-parameter
79-
- name: var-declaration
80-
- name: var-naming
81-
# additional revive rules
82-
- name: bare-return
83-
- name: bool-literal-in-expr
84-
- name: comment-spacings
85-
- name: early-return
86-
- name: defer
87-
- name: deep-exit
88-
- name: unused-receiver
89-
1+
version: "2"
902
linters:
91-
# please, do not use `enable-all`: it's deprecated and will be removed soon.
92-
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
93-
disable-all: true
3+
default: none
944
enable:
955
- asciicheck
966
- bodyclose
7+
- canonicalheader
8+
- copyloopvar
979
- dogsled
9810
- dupl
9911
- err113
10012
- errcheck
10113
- errorlint
10214
- exhaustive
103-
- exportloopref
10415
- funlen
10516
- gochecknoglobals
10617
- gochecknoinits
@@ -109,11 +20,8 @@ linters:
10920
- gocritic
11021
- gocyclo
11122
- godot
112-
- gofmt
113-
- goimports
11423
- goprintffuncname
11524
- gosec
116-
- gosimple
11725
- govet
11826
- ineffassign
11927
- lll
@@ -128,26 +36,140 @@ linters:
12836
- revive
12937
- rowserrcheck
13038
- staticcheck
131-
- stylecheck
39+
- testifylint
13240
- thelper
13341
- unconvert
13442
- unparam
13543
- unused
13644
- usestdlibvars
45+
- usetesting
13746
- whitespace
138-
- wsl
47+
- wsl_v5
13948

140-
# don't enable:
141-
# - godox # Disabling because we need TODO lines at this stage of project.
142-
# - testpackage # We also need to do unit test for unexported functions. And adding _internal in all files is cumbersome.
49+
# don't enable:
50+
# - godox # Disabling because we need TODO lines at this stage of project.
51+
# - testpackage # We also need to do unit test for unexported functions. And adding _internal in all files is cumbersome.
14352

144-
issues:
145-
# exclude-use-default: false
146-
# exclude-use-default: false # By default, golangci-lint does not enforce comments on exported types. We want it.
147-
# Excluding configuration per-path, per-linter, per-text and per-source
148-
exclude-rules:
149-
- path: _test\.go
150-
linters:
151-
- gomnd
152-
- dupl
153-
- goconst
53+
settings:
54+
dupl:
55+
threshold: 100
56+
exhaustive:
57+
default-signifies-exhaustive: false
58+
funlen:
59+
lines: 100
60+
statements: 50
61+
goconst:
62+
min-len: 2
63+
min-occurrences: 2
64+
gocritic:
65+
disabled-checks:
66+
- dupImport # https://github.com/go-critic/go-critic/issues/845
67+
- ifElseChain
68+
- octalLiteral
69+
- whyNoLint
70+
- wrapperFunc
71+
enabled-tags:
72+
- diagnostic
73+
- experimental
74+
- opinionated
75+
- performance
76+
- style
77+
gocyclo:
78+
min-complexity: 10
79+
govet:
80+
enable:
81+
- shadow
82+
settings:
83+
printf:
84+
funcs:
85+
- (gofr.dev/pkg/gofr/Logger).Logf
86+
- (gofr.dev/pkg/gofr/Logger).Errorf
87+
lll:
88+
line-length: 140
89+
misspell:
90+
locale: US
91+
mnd:
92+
checks:
93+
- argument
94+
- case
95+
- condition
96+
- return
97+
nolintlint:
98+
require-explanation: true # require an explanation for nolint directives
99+
require-specific: true # require nolint directives to be specific about which linter is being skipped
100+
allow-unused: false # report any unused nolint directives
101+
revive:
102+
rules:
103+
- name: blank-imports
104+
- name: context-as-argument
105+
- name: context-keys-type
106+
- name: dot-imports
107+
- name: empty-block
108+
- name: error-naming
109+
- name: error-return
110+
- name: error-strings
111+
- name: errorf
112+
- name: exported
113+
arguments:
114+
# enables checking public methods of private types
115+
- checkPrivateReceivers
116+
# make error messages clearer
117+
- sayRepetitiveInsteadOfStutters
118+
- name: increment-decrement
119+
- name: indent-error-flow
120+
- name: range
121+
- name: receiver-naming
122+
- name: redefines-builtin-id
123+
- name: superfluous-else
124+
- name: time-naming
125+
- name: unexported-return
126+
- name: unreachable-code
127+
- name: unused-parameter
128+
- name: var-declaration
129+
- name: var-naming
130+
- name: bare-return
131+
- name: bool-literal-in-expr
132+
- name: comment-spacings
133+
- name: early-return
134+
- name: defer
135+
- name: deep-exit
136+
- name: unused-receiver
137+
- name: use-any
138+
staticcheck:
139+
checks:
140+
- all
141+
- -QF1001 # TODO remove this line and fix reported errors
142+
- -QF1003 # TODO remove this line and fix reported errors
143+
- -QF1008 # TODO remove this line and fix reported errors
144+
- -ST1000 # TODO remove this line and fix reported errors
145+
usestdlibvars:
146+
time-layout: true
147+
exclusions:
148+
presets:
149+
- common-false-positives # TODO fix errors reported by this and remove this line
150+
- legacy # TODO fix errors reported by this and remove this line
151+
- std-error-handling # TODO remove this line, configure errcheck, and fix reported errors
152+
rules:
153+
- linters:
154+
- dupl
155+
- goconst
156+
- mnd
157+
path: _test\.go
158+
- linters:
159+
- revive
160+
text: "exported (.+) should have comment" # TODO fix errors reported by this and remove this line
161+
paths:
162+
- examples # TODO remove this line and fix reported errors
163+
formatters:
164+
enable:
165+
- gci
166+
- gofmt
167+
settings:
168+
gci:
169+
sections:
170+
- standard
171+
- default
172+
- localmodule
173+
goimports:
174+
local-prefixes:
175+
- gofr.dev

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99

1010
<div align="center">
11+
<a href="https://pkg.go.dev/gofr.dev/cli/gofr"><img src="https://img.shields.io/badge/GoDoc-Read%20Documentation-blue?style=for-the-badge" alt="godoc"></a>
12+
<a href="https://gofr.dev/docs/references/gofrcli"><img src="https://img.shields.io/badge/GoFr-Docs-orange?style=for-the-badge" alt="gofr-docs"></a>
1113
<a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache_2.0-blue?style=for-the-badge" alt="Apache 2.0 License"></a>
1214
<a href="https://discord.gg/wsaSkQTdgq"><img src="https://img.shields.io/badge/discord-join-us?style=for-the-badge&logo=discord&color=7289DA" alt="discord" /></a>
1315
</div>
@@ -69,4 +71,4 @@ If your PR is merged, or if you contribute by writing articles or promoting GoFr
6971

7072
### Partners
7173

72-
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.png" alt="JetBrains logo" width="200">
74+
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.png" alt="JetBrains logo" width="200">

bootstrap/init.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
func main() {
2525
app := gofr.New()
2626
27-
app.GET("/hello", func(ctx *gofr.Context) (interface{}, error) {
27+
app.GET("/hello", func(ctx *gofr.Context) (any, error) {
2828
return "Hello World!", nil
2929
})
3030
@@ -39,7 +39,7 @@ type modInfo struct {
3939
GofrVersion string
4040
}
4141

42-
func Create(ctx *gofr.Context) (interface{}, error) {
42+
func Create(ctx *gofr.Context) (any, error) {
4343
name := ctx.Param("name")
4444
gofrVersion := ctx.Param("gofr")
4545

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func main() {
1414
cli.SubCommand("init", bootstrap.Create)
1515

1616
cli.SubCommand("version",
17-
func(*gofr.Context) (interface{}, error) {
17+
func(*gofr.Context) (any, error) {
1818
return CLIVersion, nil
1919
},
2020
)

main_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"testing"
66

77
"github.com/stretchr/testify/assert"
8-
98
"gofr.dev/pkg/gofr/testutil"
109
)
1110

0 commit comments

Comments
 (0)