Skip to content

Commit

Permalink
Add mongo-tools back
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekSi committed Aug 20, 2024
1 parent 9447711 commit 43e1d04
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
12 changes: 3 additions & 9 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,9 @@ tasks:
lint:
desc: "Run linters"
cmds:
- >
bin/golangci-lint run --config=.golangci.yml
./cmd/... ./internal/... ./projects/mongo-tools/...
- >
bin/golangci-lint run --config=.golangci-new.yml
./cmd/... ./internal/... ./projects/mongo-tools/...
- >
bin/go-consistent -pedantic
./cmd/... ./internal/... ./projects/mongo-tools/...
- bin/golangci-lint run --config=.golangci.yml ./cmd/... ./internal/... ./projects/mongo-tools/...
- bin/golangci-lint run --config=.golangci-new.yml ./cmd/... ./internal/... ./projects/mongo-tools/...
- bin/go-consistent -pedantic ./cmd/... ./internal/... ./projects/mongo-tools/...

godocs:
desc: "Serve Go code documentation"
Expand Down
9 changes: 9 additions & 0 deletions internal/config/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,16 @@ type RunnerParamsCommandTest struct {
// runnerParams implements [RunnerParams] interface.
func (rp *RunnerParamsCommand) runnerParams() {}

// RunnerParamsGoTest represents `gotest` runner parameters.
type RunnerParamsGoTest struct {
Args []string
}

// runnerParams implements [RunnerParams] interface.
func (rp *RunnerParamsGoTest) runnerParams() {}

// check interfaces
var (
_ RunnerParams = (*RunnerParamsCommand)(nil)
_ RunnerParams = (*RunnerParamsGoTest)(nil)
)
13 changes: 13 additions & 0 deletions internal/configload/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,20 @@ func (rp *runnerParamsCommand) convert() config.RunnerParams {
return res
}

// runnerParamsGoTest represents `gotest` runner parameters in the project configuration YAML file.
type runnerParamsGoTest struct {
Args []string `yaml:"args"`
}

// convert implements [runnerParams] interface.
func (rp *runnerParamsGoTest) convert() config.RunnerParams {
return &config.RunnerParamsGoTest{
Args: rp.Args,
}
}

// check interfaces
var (
_ runnerParams = (*runnerParamsCommand)(nil)
_ runnerParams = (*runnerParamsGoTest)(nil)
)
1 change: 1 addition & 0 deletions internal/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

// Runner is a common interface for all runners.
type Runner interface {
// Run executes configured tests and returns results by test name.
Run(ctx context.Context) (map[string]config.TestResult, error)
}

Expand Down
2 changes: 1 addition & 1 deletion tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
golang.org/x/pkgsite v0.0.0-20240806212006-da7af58eca47
golang.org/x/tools v0.24.0
golang.org/x/vuln v1.1.3
mvdan.cc/gofumpt v0.6.0
mvdan.cc/gofumpt v0.7.0
)

require (
Expand Down
6 changes: 4 additions & 2 deletions tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI=
github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow=
github.com/go-redis/redis/v9 v9.0.0-rc.1 h1:/+bS+yeUnanqAbuD3QwlejzQZ+4eqgfUtFTG4b+QnXs=
github.com/go-redis/redis/v9 v9.0.0-rc.1/go.mod h1:8et+z03j0l8N+DvsVnclzjf3Dl/pFHgRk+2Ct1qw66A=
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
Expand Down Expand Up @@ -1336,8 +1338,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.5.0 h1:29uoiIormS3Z6R+t56STz/oI4v+mB51TSmEOdJPgRnE=
honnef.co/go/tools v0.5.0/go.mod h1:e9irvo83WDG9/irijV44wr3tbhcFeRnfpVlRqVwpzMs=
mvdan.cc/gofumpt v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo=
mvdan.cc/gofumpt v0.6.0/go.mod h1:4L0wf+kgIPZtcCWXynNS2e6bhmj73umwnuXSZarixzA=
mvdan.cc/gofumpt v0.7.0 h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU=
mvdan.cc/gofumpt v0.7.0/go.mod h1:txVFJy/Sc/mvaycET54pV8SW8gWxTlUuGHVEcncmNUo=
mvdan.cc/sh/v3 v3.8.0 h1:ZxuJipLZwr/HLbASonmXtcvvC9HXY9d2lXZHnKGjFc8=
mvdan.cc/sh/v3 v3.8.0/go.mod h1:w04623xkgBVo7/IUK89E0g8hBykgEpN0vgOj3RJr6MY=
mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f h1:lMpcwN6GxNbWtbpI1+xzFLSW8XzX0u72NttUGVFjO3U=
Expand Down

0 comments on commit 43e1d04

Please sign in to comment.