[Vendor] Switch go-version lib (#12719)

* vendor: switch from "mcuadros/go-version" to "hashicorp/go-version"

* Adapt P1

* simplify

* fix lint

* adapt

* fix lint & rm old code

* no deadlock

* rm RWMutex and check GoVersion only 1-time

* Copyright header

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
6543 2020-09-05 18:42:58 +02:00 committed by GitHub
parent 9fdb4f887b
commit bc11caff94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 1134 additions and 966 deletions

View file

@ -7,8 +7,6 @@ package git
import (
"bytes"
"fmt"
"github.com/mcuadros/go-version"
)
// CheckAttributeOpts represents the possible options to CheckAttribute
@ -21,7 +19,7 @@ type CheckAttributeOpts struct {
// CheckAttribute return the Blame object of file
func (repo *Repository) CheckAttribute(opts CheckAttributeOpts) (map[string]map[string]string, error) {
binVersion, err := BinVersion()
err := LoadGitVersion()
if err != nil {
return nil, fmt.Errorf("Git version missing: %v", err)
}
@ -42,7 +40,7 @@ func (repo *Repository) CheckAttribute(opts CheckAttributeOpts) (map[string]map[
}
// git check-attr --cached first appears in git 1.7.8
if opts.CachedOnly && version.Compare(binVersion, "1.7.8", ">=") {
if opts.CachedOnly && CheckGitVersionConstraint(">= 1.7.8") == nil {
cmdArgs = append(cmdArgs, "--cached")
}