Skip to content

Commit

Permalink
feat: update deps and linter issues (#56)
Browse files Browse the repository at this point in the history
Signed-off-by: tkrop <[email protected]>
  • Loading branch information
tkrop authored Nov 9, 2023
1 parent 8f6a606 commit d31579e
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 21 deletions.
15 changes: 12 additions & 3 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ run:
# Default: 1m
timeout: 3m

linters:
linters: {}
# Placeholder for dynamically enabled linters.

issues:
Expand Down Expand Up @@ -35,7 +35,7 @@ issues:
linters: [ errcheck ]
# Exclude certain revive standards from being applied in tests.
- path: "_test\\.go"
text: "^(max-public-structs|function-length|cognitive-complexity):"
text: "^(max-public-structs|function-length|cognitive-complexity|unchecked-type-assertion):"
linters: [ revive ]
# Exclude dots in unfinished thoughts.
- source: "(noinspection|TODO)"
Expand Down Expand Up @@ -96,7 +96,7 @@ linters-settings:
# To specify a set of rules to explicitly exclude.
# Available rules: https://github.com/securego/gosec#available-rules
# Default: [] (issues are fixed)
excludes: [ G105, G307 ]
excludes: [ G307 ]

gocritic:
# Settings passed to gocritic. The settings key is the name of a supported
Expand Down Expand Up @@ -142,9 +142,18 @@ linters-settings:
# Reports on comments not matching the name as first word.
- name: exported
disabled: true
# Ident error flow is buggy and throws false alerts.
- name: indent-error-flow
disabled: true
# No need to exclude import shadowing.
- name: import-shadowing
disabled: true
# Restricted alias naming conflicts with '.'-imports.
- name: import-alias-naming
disabled: true
# Exluding '.'-import makes test package separation unnecessary difficult.
- name: dot-imports
disabled: true
# Fails to exclude nolint directives from reporting.
- name: comment-spacings
disabled: true
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
[coveralls-link]: https://coveralls.io/github/tkrop/go-testing?branch=main

[coverage-badge]: https://app.codacy.com/project/badge/Coverage/cc1c47ec5ce0493caf15c08fa72fc78c
[coverage-link]: https://www.codacy.com/gh/tkrop/go-testing/dashboard?utm_source=github.com&utm_medium=referral&utm_content=tkrop/go-testing&utm_campaign=Badge_Coverage
[coverage-link]: https://app.codacy.com/gh/tkrop/go-testing/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage

[quality-badge]: https://app.codacy.com/project/badge/Grade/cc1c47ec5ce0493caf15c08fa72fc78c
[quality-link]: https://www.codacy.com/gh/tkrop/go-testing/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=tkrop/go-testing&amp;utm_campaign=Badge_Grade
[quality-link]: https://app.codacy.com/gh/tkrop/go-testing/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade

[report-badge]: https://goreportcard.com/badge/github.com/tkrop/go-testing
[report-link]: https://goreportcard.com/report/github.com/tkrop/go-testing
Expand Down Expand Up @@ -243,7 +243,7 @@ implementations for most common tasks. Read the [go-make manual][go-make-man]
for more information about how to build, test, lint, etc.

[go-make]: <https://github.com/tkrop/go-make>
[go-make-man]: <https://github.com/tkrop/go-make/MANUAL.md>
[go-make-man]: <https://github.com/tkrop/go-make/blob/main/MANUAL.md>


## Contributing
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ require (
github.com/h2non/gock v1.2.0
github.com/huandu/go-clone v1.6.0
github.com/stretchr/testify v1.8.4
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
golang.org/x/exp v0.0.0-20231108232855-2478ac86f678
golang.org/x/text v0.13.0
golang.org/x/tools v0.13.0
golang.org/x/tools v0.15.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/sys v0.14.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,25 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 h1:mchzmB1XO2pMaKFRqk/+MV3mgGG96aqaPXaMifQU47w=
golang.org/x/exp v0.0.0-20231108232855-2478ac86f678/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
Expand All @@ -60,8 +60,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8=
golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
2 changes: 1 addition & 1 deletion internal/mock/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/assert"

. "github.com/tkrop/go-testing/internal/mock"
mock "github.com/tkrop/go-testing/mock"
"github.com/tkrop/go-testing/mock"
"github.com/tkrop/go-testing/test"
)

Expand Down
1 change: 1 addition & 0 deletions internal/mock/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ func NewMethods(iface *types.Interface) []*Method {
methods := make([]*Method, 0, iface.NumMethods())
for index := 0; index < iface.NumMethods(); index++ {
method := iface.Method(index)
//revive:disable-next-line:unchecked-type-assertion // cannot happen
sign := method.Type().Underlying().(*types.Signature)
methods = append(methods, &Method{
Name: method.Name(),
Expand Down
1 change: 1 addition & 0 deletions mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ func (mocks *Mocks) notify(
// Get resolves the actual mock from the mock handler by providing the
// constructor function generated by `gomock` to create a new mock.
func Get[T any](mocks *Mocks, creator func(*Controller) *T) *T {
//revive:disable-next-line:unchecked-type-assertion // cannot happen
return mocks.Get(reflect.ValueOf(creator)).(*T)
}

Expand Down
9 changes: 9 additions & 0 deletions revive.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ enableAllRules = true
[rule.import-shadowing]
disabled = true

# Restricted alias naming conflicts with '.'-imports.
# Not supporte by current Codacy revive v1.2.3
#[rule.import-alias-naming]
# disabled = true

# Exluding '.'-import makes test package separation unnecessary difficult.
[rule.dot-imports]
disabled = true

# Fails to exclude nolint directives from reporting.
# Not supporte by current Codacy revive v1.2.3
#[rule.comment-spacings]
Expand Down

0 comments on commit d31579e

Please sign in to comment.