Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix linting errors #199

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/lint-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
go-version: '1.20'
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: v1.52.2
version: v1.56.2
args: --timeout=5m
21 changes: 11 additions & 10 deletions echox/echo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ func TestServe(t *testing.T) {

return
}

reqResp = resp

_, _ = io.Copy(io.Discard, resp.Body)
Expand Down Expand Up @@ -702,7 +703,7 @@ func TestAddReadinessCheck(t *testing.T) {
{
"single check, ok",
map[string]CheckFunc{
"test": func(ctx context.Context) error {
"test": func(_ context.Context) error {
return nil
},
},
Expand All @@ -712,7 +713,7 @@ func TestAddReadinessCheck(t *testing.T) {
{
"single check, fail",
map[string]CheckFunc{
"test": func(ctx context.Context) error {
"test": func(_ context.Context) error {
return errored
},
},
Expand All @@ -722,10 +723,10 @@ func TestAddReadinessCheck(t *testing.T) {
{
"multiple checks, ok",
map[string]CheckFunc{
"test1": func(ctx context.Context) error {
"test1": func(_ context.Context) error {
return nil
},
"test2": func(ctx context.Context) error {
"test2": func(_ context.Context) error {
return nil
},
},
Expand All @@ -735,10 +736,10 @@ func TestAddReadinessCheck(t *testing.T) {
{
"multiple checks, first fail",
map[string]CheckFunc{
"test1": func(ctx context.Context) error {
"test1": func(_ context.Context) error {
return errored
},
"test2": func(ctx context.Context) error {
"test2": func(_ context.Context) error {
return nil
},
},
Expand All @@ -748,10 +749,10 @@ func TestAddReadinessCheck(t *testing.T) {
{
"multiple checks, last fail",
map[string]CheckFunc{
"test1": func(ctx context.Context) error {
"test1": func(_ context.Context) error {
return nil
},
"test2": func(ctx context.Context) error {
"test2": func(_ context.Context) error {
return errored
},
},
Expand All @@ -761,10 +762,10 @@ func TestAddReadinessCheck(t *testing.T) {
{
"multiple checks, all fail",
map[string]CheckFunc{
"test1": func(ctx context.Context) error {
"test1": func(_ context.Context) error {
return errored
},
"test2": func(ctx context.Context) error {
"test2": func(_ context.Context) error {
return errored
},
},
Expand Down
3 changes: 2 additions & 1 deletion echox/echozap/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestToMiddleware(t *testing.T) {
}
}
returnError := func(iErr any) echo.HandlerFunc {
return func(c echo.Context) error {
return func(_ echo.Context) error {
if err, ok := iErr.(error); ok {
return err
}
Expand Down Expand Up @@ -268,6 +268,7 @@ func TestToMiddleware(t *testing.T) {
if tc.config.Logger != nil {
tc.config.Logger = zap.New(obsZapCore)
}

mdw, err := tc.config.ToMiddleware()

if tc.expectConfigError != nil {
Expand Down
8 changes: 4 additions & 4 deletions entx/gql_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
//
//nolint:goerr113
var (
removeNodeGoModel = func(g *gen.Graph, s *ast.Schema) error {
removeNodeGoModel = func(_ *gen.Graph, s *ast.Schema) error {
n, ok := s.Types["Node"]
if !ok {
return errors.New("failed to find node interface in schema")
Expand All @@ -47,7 +47,7 @@ var (
return nil
}

removeNodeQueries = func(g *gen.Graph, s *ast.Schema) error {
removeNodeQueries = func(_ *gen.Graph, s *ast.Schema) error {
q, ok := s.Types["Query"]
if !ok {
return errors.New("failed to find query definition in schema")
Expand All @@ -69,7 +69,7 @@ var (
return nil
}

setPageInfoShareable = func(g *gen.Graph, s *ast.Schema) error {
setPageInfoShareable = func(_ *gen.Graph, s *ast.Schema) error {
q, ok := s.Types["PageInfo"]
if !ok {
return nil
Expand All @@ -80,7 +80,7 @@ var (
return nil
}

addJSONScalar = func(g *gen.Graph, s *ast.Schema) error {
addJSONScalar = func(_ *gen.Graph, s *ast.Schema) error {
s.Types["JSON"] = &ast.Definition{
Kind: ast.Scalar,
Description: "A valid JSON string.",
Expand Down
2 changes: 2 additions & 0 deletions entx/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ func TestUnmarshalRawMessage(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := UnmarshalRawMessage(tt.arg)

if (err != nil) != tt.wantErr {
t.Errorf("UnmarshalRawMessage() error = %v, wantErr %v", err, tt.wantErr)
return
}

if !reflect.DeepEqual(got, tt.want) {
t.Errorf("UnmarshalRawMessage() = %s, want %s", got, tt.want)
}
Expand Down
2 changes: 1 addition & 1 deletion ginx/gin.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type LogFunc func(c *gin.Context) []zapcore.Field
type CheckFunc func(ctx context.Context) error

var (
emptyLogFn = func(c *gin.Context) []zapcore.Field { return []zapcore.Field{} }
emptyLogFn = func(_ *gin.Context) []zapcore.Field { return []zapcore.Field{} }

// DefaultServerShutdownTimeout sets the default for how long we give the sever
// to shutdown before forcefully stopping the server.
Expand Down
2 changes: 1 addition & 1 deletion goosex/cobra.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ create NAME [sql|go] Creates new migration file with the current timestamp
fix Apply sequential ordering to migrations
`,
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
setupFunc()
migrate(args[0], args[1:])
},
Expand Down
4 changes: 2 additions & 2 deletions testing/eventtools/nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (s *TestNats) SetConsumerSampleFrequency(consumer, frequency string) error
func (s *TestNats) WaitForAck(consumer string, timeout time.Duration) error {
// We should only ever receive one Ack, so we close the channel directly if we get one.
ackCh := make(chan struct{})
ackSub, err := s.Conn.Subscribe("$JS.EVENT.METRIC.CONSUMER.ACK.*."+consumer, func(m *nats.Msg) {
ackSub, err := s.Conn.Subscribe("$JS.EVENT.METRIC.CONSUMER.ACK.*."+consumer, func(_ *nats.Msg) {
close(ackCh)
})

Expand All @@ -96,7 +96,7 @@ func (s *TestNats) WaitForAck(consumer string, timeout time.Duration) error {

var nakOnce sync.Once

nakSub, err := s.Conn.Subscribe("$JS.EVENT.ADVISORY.CONSUMER.MSG_NAKED.*."+consumer, func(m *nats.Msg) {
nakSub, err := s.Conn.Subscribe("$JS.EVENT.ADVISORY.CONSUMER.MSG_NAKED.*."+consumer, func(_ *nats.Msg) {
nakOnce.Do(func() {
close(nakCh)
})
Expand Down
2 changes: 1 addition & 1 deletion versionx/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func RegisterCobraCommand(cmd *cobra.Command, printFunc func()) {
var versionCmd = &cobra.Command{
Use: "version",
Short: "returns the application version information",
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
printFunc()
},
}
Expand Down
Loading