1
0
mirror of https://github.com/mgechev/revive.git synced 2025-11-23 22:04:49 +02:00

feature: add support for omitzero in rule struct-tag (#1238)

This commit is contained in:
chavacava
2025-02-16 11:31:17 +01:00
committed by GitHub
parent a59a2288fd
commit 8ece20b078
6 changed files with 154 additions and 8 deletions

View File

@@ -38,6 +38,7 @@ var (
go115 = goversion.Must(goversion.NewVersion("1.15"))
go121 = goversion.Must(goversion.NewVersion("1.21"))
go122 = goversion.Must(goversion.NewVersion("1.22"))
go124 = goversion.Must(goversion.NewVersion("1.24"))
)
// Files return package's files.
@@ -210,6 +211,11 @@ func (p *Package) IsAtLeastGo122() bool {
return p.goVersion.GreaterThanOrEqual(go122)
}
// IsAtLeastGo124 returns true if the Go version for this package is 1.24 or higher, false otherwise
func (p *Package) IsAtLeastGo124() bool {
return p.goVersion.GreaterThanOrEqual(go124)
}
func getSortableMethodFlagForFunction(fn *ast.FuncDecl) sortableMethodsFlags {
switch {
case astutils.FuncSignatureIs(fn, "Len", []string{}, []string{"int"}):