diff --git a/docs/layouts/_partials/compare-versions.html b/docs/layouts/_partials/compare-versions.html index 45cad4ce14d5..917efd31f970 100644 --- a/docs/layouts/_partials/compare-versions.html +++ b/docs/layouts/_partials/compare-versions.html @@ -3,7 +3,7 @@ @param {string} a Version A @param {string} b Version B -@returns {boolean} +@returns {int} -1 if a < b, 0 if a == b, 1 if a > b @example {{ partial "compare-versions.html" (dict "a" "v1.2.3" "b" "v1.2.4") }} */ -}} @@ -11,4 +11,11 @@ {{- $aVersion := path.Dir (replace .a "." "/") -}} {{- $bVersion := path.Dir (replace .b "." "/") -}} -{{- return (eq $aVersion $bVersion) -}} +{{- $result := 0 -}} +{{- if (lt $aVersion $bVersion) -}} + {{- $result = -1 -}} +{{- end -}} +{{- if (gt $aVersion $bVersion) -}} + {{- $result = 1 -}} +{{- end -}} +{{- return $result -}} diff --git a/docs/layouts/_partials/item-tag.html b/docs/layouts/_partials/item-tag.html index 93dc2ee40b21..4f57419b0d9f 100644 --- a/docs/layouts/_partials/item-tag.html +++ b/docs/layouts/_partials/item-tag.html @@ -21,7 +21,7 @@ {{- $tag.SetInMap "options" "subtitle" (print (strings.FirstUpper $item.deprecation.message) $replacement) -}} {{- $tag.SetInMap "options" "tag" (print "Deprecated since " $item.deprecation.since) -}} {{- $tag.SetInMap "options" "tagType" "error" -}} -{{- else if (partial "compare-versions.html" (dict "a" $gcilVersion "b" $item.since)) -}} +{{- else if eq (partial "compare-versions.html" (dict "a" $gcilVersion "b" $item.since)) 0 -}} {{- $tag.SetInMap "options" "tag" "New" -}} {{- $tag.SetInMap "options" "tagType" "warning" -}} {{- else if $item.canAutoFix -}} diff --git a/docs/layouts/_shortcodes/item-cards.html b/docs/layouts/_shortcodes/item-cards.html index 9d34c3002b7f..ffca0938fd93 100644 --- a/docs/layouts/_shortcodes/item-cards.html +++ b/docs/layouts/_shortcodes/item-cards.html @@ -76,7 +76,7 @@ {{- if in .groups "standard" -}} {{- $class = $class | append "gl-default" -}} {{- end -}} - {{- if (partial "compare-versions.html" (dict "a" $gcilVersion "b" .since)) -}} + {{- if eq (partial "compare-versions.html" (dict "a" $gcilVersion "b" .since)) 0 -}} {{- $class = $class | append "gl-new" -}} {{- end -}} diff --git a/docs/layouts/_shortcodes/item-settings.html b/docs/layouts/_shortcodes/item-settings.html index abf5502066a3..ffddd372a918 100644 --- a/docs/layouts/_shortcodes/item-settings.html +++ b/docs/layouts/_shortcodes/item-settings.html @@ -34,22 +34,32 @@ {{/* Badges */}}
+{{ $sinceLink := "/docs/product/changelog/" }} + +{{ if eq (partial "compare-versions.html" (dict "a" .since "b" "v1.43.0")) 1 }} + {{ $sinceLink = (print "/docs/product/changelog/#" (replace .since "." "")) }} +{{ end }} + {{ partial "shortcodes/badge.html" (dict "border" true "icon" "calendar" "content" (print "Since golangci-lint " .since) ) }} + {{ if .deprecation -}} +{{ $deprecatedSinceLink := (print "/docs/product/changelog/#" (replace .deprecation.since "." "")) }} + {{ partial "shortcodes/badge.html" (dict "border" true "icon" "sparkles" "content" (print "Deprecated since " .deprecation.since) "type" "error" ) - }} +}} + {{ else }} - {{ if (partial "compare-versions.html" (dict "a" $gcilVersion "b" .since)) }} + {{ if eq (partial "compare-versions.html" (dict "a" $gcilVersion "b" .since)) 0 }} {{ partial "shortcodes/badge.html" (dict "border" true "icon" "sparkles" diff --git a/pkg/lint/lintersdb/builder_linter.go b/pkg/lint/lintersdb/builder_linter.go index df84ad737966..4c9541566660 100644 --- a/pkg/lint/lintersdb/builder_linter.go +++ b/pkg/lint/lintersdb/builder_linter.go @@ -241,7 +241,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) { WithURL("https://github.com/polyfloyd/go-errorlint"), linter.NewConfig(exhaustive.New(&cfg.Linters.Settings.Exhaustive)). - WithSince(" v1.28.0"). + WithSince("v1.28.0"). WithLoadForGoAnalysis(). WithURL("https://github.com/nishanths/exhaustive"),