summaryrefslogtreecommitdiffstats
path: root/vendor
diff options
context:
space:
mode:
authorColin Arnott <carnott@snapchat.com>2019-10-15 21:24:16 +0000
committerzeripath <art27@cantab.net>2019-10-15 22:24:16 +0100
commit66e99d722a71d12b81264bc3577b85febe40e49e (patch)
tree99e4906ab068e35b393dbf7b941405127fd283fe /vendor
parent80655026d2cc8e56223be546a5ed46634eafa059 (diff)
downloadgitea-66e99d722a71d12b81264bc3577b85febe40e49e.tar.gz
gitea-66e99d722a71d12b81264bc3577b85febe40e49e.zip
upgrade gopkg.in/editorconfig/editorconfig-core-go.v1 (#8501)
editorconfig-core-go made breaking api changes and has recently released v2.1.1. This change consumes the new api and fixes up any breaking references.
Diffstat (limited to 'vendor')
-rw-r--r--vendor/github.com/editorconfig/editorconfig-core-go/v2/.editorconfig (renamed from vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.editorconfig)5
-rw-r--r--vendor/github.com/editorconfig/editorconfig-core-go/v2/.gitattributes1
-rw-r--r--vendor/github.com/editorconfig/editorconfig-core-go/v2/.gitignore (renamed from vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitignore)0
-rw-r--r--vendor/github.com/editorconfig/editorconfig-core-go/v2/.gitmodules (renamed from vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitmodules)0
-rw-r--r--vendor/github.com/editorconfig/editorconfig-core-go/v2/.travis.yml30
-rw-r--r--vendor/github.com/editorconfig/editorconfig-core-go/v2/CHANGELOG.md20
-rw-r--r--vendor/github.com/editorconfig/editorconfig-core-go/v2/CMakeLists.txt5
-rw-r--r--vendor/github.com/editorconfig/editorconfig-core-go/v2/LICENSE (renamed from vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/LICENSE)0
-rw-r--r--vendor/github.com/editorconfig/editorconfig-core-go/v2/Makefile19
-rw-r--r--vendor/github.com/editorconfig/editorconfig-core-go/v2/README.md (renamed from vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/README.md)27
-rw-r--r--vendor/github.com/editorconfig/editorconfig-core-go/v2/editorconfig.go (renamed from vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/editorconfig.go)129
-rw-r--r--vendor/github.com/editorconfig/editorconfig-core-go/v2/fnmatch.go177
-rw-r--r--vendor/github.com/editorconfig/editorconfig-core-go/v2/go.mod9
-rw-r--r--vendor/github.com/editorconfig/editorconfig-core-go/v2/go.sum22
-rw-r--r--vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitattributes5
-rw-r--r--vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.travis.yml14
-rw-r--r--vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/Makefile25
-rw-r--r--vendor/modules.txt4
18 files changed, 381 insertions, 111 deletions
diff --git a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.editorconfig b/vendor/github.com/editorconfig/editorconfig-core-go/v2/.editorconfig
index 715e21f1de..aca7129072 100644
--- a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.editorconfig
+++ b/vendor/github.com/editorconfig/editorconfig-core-go/v2/.editorconfig
@@ -3,11 +3,12 @@
root = true
[*]
-end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
+indent_style = space
+indent_size = 2
-[*.go]
+[{Makefile,go.mod,go.sum,*.go}]
indent_style = tab
indent_size = 8
diff --git a/vendor/github.com/editorconfig/editorconfig-core-go/v2/.gitattributes b/vendor/github.com/editorconfig/editorconfig-core-go/v2/.gitattributes
new file mode 100644
index 0000000000..176a458f94
--- /dev/null
+++ b/vendor/github.com/editorconfig/editorconfig-core-go/v2/.gitattributes
@@ -0,0 +1 @@
+* text=auto
diff --git a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitignore b/vendor/github.com/editorconfig/editorconfig-core-go/v2/.gitignore
index f5dcd26083..f5dcd26083 100644
--- a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitignore
+++ b/vendor/github.com/editorconfig/editorconfig-core-go/v2/.gitignore
diff --git a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitmodules b/vendor/github.com/editorconfig/editorconfig-core-go/v2/.gitmodules
index 9e75e1ca0b..9e75e1ca0b 100644
--- a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitmodules
+++ b/vendor/github.com/editorconfig/editorconfig-core-go/v2/.gitmodules
diff --git a/vendor/github.com/editorconfig/editorconfig-core-go/v2/.travis.yml b/vendor/github.com/editorconfig/editorconfig-core-go/v2/.travis.yml
new file mode 100644
index 0000000000..9a1fdf77df
--- /dev/null
+++ b/vendor/github.com/editorconfig/editorconfig-core-go/v2/.travis.yml
@@ -0,0 +1,30 @@
+---
+language: go
+dist: xenial
+sudo: true
+
+go:
+ - '1.11.x'
+ - '1.12.x'
+
+compiler:
+ - gcc
+
+install:
+ # first we create a directory for the CMake binaries
+ - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
+ - mkdir ${DEPS_DIR} && cd ${DEPS_DIR}
+ # we use wget to fetch the cmake binaries
+ - travis_retry wget --no-check-certificate https://cmake.org/files/v3.14/cmake-3.14.6-Linux-x86_64.tar.gz
+ - echo "82e08e50ba921035efa82b859c74c5fbe27d3e49a4003020e3c77618a4e912cd cmake-3.14.6-Linux-x86_64.tar.gz" > sha256sum.txt
+ - sha256sum -c sha256sum.txt
+ - tar -xvf cmake-3.14.6-Linux-x86_64.tar.gz > /dev/null
+ - mv cmake-3.14.6-Linux-x86_64 cmake-install
+ - PATH=${DEPS_DIR}/cmake-install:${DEPS_DIR}/cmake-install/bin:$PATH
+ - cd ${TRAVIS_BUILD_DIR}
+
+env:
+ - GO111MODULE=on
+
+script:
+ - make test
diff --git a/vendor/github.com/editorconfig/editorconfig-core-go/v2/CHANGELOG.md b/vendor/github.com/editorconfig/editorconfig-core-go/v2/CHANGELOG.md
new file mode 100644
index 0000000000..c09da69744
--- /dev/null
+++ b/vendor/github.com/editorconfig/editorconfig-core-go/v2/CHANGELOG.md
@@ -0,0 +1,20 @@
+# Change log
+
+## v2.1.1 - 2019-08-18
+
+- Fix a small path bug
+ ([#17](https://github.com/editorconfig/editorconfig-core-go/issues/17),
+ [#18](https://github.com/editorconfig/editorconfig-core-go/pull/18)).
+
+## v2.1.0 - 2019-08-10
+
+- This package is now *way* more compliant with the Editorconfig definition
+ thanks to a refactor work made by [@greut](https://github.com/greut)
+ ([#15](https://github.com/editorconfig/editorconfig-core-go/pull/15)).
+
+## v2.0.0 - 2019-07-14
+
+- This project now uses [Go Modules](https://blog.golang.org/using-go-modules)
+ ([#14](https://github.com/editorconfig/editorconfig-core-go/pull/14)).
+- The import path has been changed from `gopkg.in/editorconfig/editorconfig-core-go.v1`
+ to `github.com/editorconfig/editorconfig-core-go/v2`.
diff --git a/vendor/github.com/editorconfig/editorconfig-core-go/v2/CMakeLists.txt b/vendor/github.com/editorconfig/editorconfig-core-go/v2/CMakeLists.txt
new file mode 100644
index 0000000000..1ebcf1d173
--- /dev/null
+++ b/vendor/github.com/editorconfig/editorconfig-core-go/v2/CMakeLists.txt
@@ -0,0 +1,5 @@
+project(editorconfig-core-go)
+cmake_minimum_required(VERSION 3.14)
+enable_testing()
+set(EDITORCONFIG_CMD ${CMAKE_CURRENT_LIST_DIR}/editorconfig)
+add_subdirectory(core-test)
diff --git a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/LICENSE b/vendor/github.com/editorconfig/editorconfig-core-go/v2/LICENSE
index 4a30d56440..4a30d56440 100644
--- a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/LICENSE
+++ b/vendor/github.com/editorconfig/editorconfig-core-go/v2/LICENSE
diff --git a/vendor/github.com/editorconfig/editorconfig-core-go/v2/Makefile b/vendor/github.com/editorconfig/editorconfig-core-go/v2/Makefile
new file mode 100644
index 0000000000..eff4473ddf
--- /dev/null
+++ b/vendor/github.com/editorconfig/editorconfig-core-go/v2/Makefile
@@ -0,0 +1,19 @@
+PROJECT_ROOT_DIR := $(CURDIR)
+SRC := $(shell git ls-files *.go */*.go)
+
+.PHONY: bin test test-go test-core submodule
+
+test: test-go test-core
+
+submodule:
+ git submodule update --init
+
+editorconfig: $(SRC)
+ go build ./cmd/editorconfig
+
+test-go:
+ go test -v ./...
+
+test-core: editorconfig
+ cd core-test; cmake ..
+ cd core-test; ctest -E "(comments_after_section|octothorpe|unset_|_pre_0.9.0|max_|root_file_mixed_case)" --output-on-failure .
diff --git a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/README.md b/vendor/github.com/editorconfig/editorconfig-core-go/v2/README.md
index e060f1061f..784e37cf54 100644
--- a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/README.md
+++ b/vendor/github.com/editorconfig/editorconfig-core-go/v2/README.md
@@ -1,27 +1,30 @@
-[![Build Status](https://travis-ci.org/editorconfig/editorconfig-core-go.svg?branch=master)](https://travis-ci.org/editorconfig/editorconfig-core-go)
-[![GoDoc](https://godoc.org/gopkg.in/editorconfig/editorconfig-core-go.v1?status.svg)](https://godoc.org/gopkg.in/editorconfig/editorconfig-core-go.v1)
-[![Go Report Card](https://goreportcard.com/badge/gopkg.in/editorconfig/editorconfig-core-go.v1)](https://goreportcard.com/report/gopkg.in/editorconfig/editorconfig-core-go.v1)
+<!-- Currently tests against core-test are not done so hide build status badge for now -->
+<!-- [![Build Status](https://travis-ci.org/editorconfig/editorconfig-core-go.svg?branch=master)](https://travis-ci.org/editorconfig/editorconfig-core-go) -->
+[![GoDoc](https://godoc.org/github.com/editorconfig/editorconfig-core-go?status.svg)](https://godoc.org/github.com/editorconfig/editorconfig-core-go)
+[![Go Report Card](https://goreportcard.com/badge/github.com/editorconfig/editorconfig-core-go)](https://goreportcard.com/report/github.com/editorconfig/editorconfig-core-go)
# Editorconfig Core Go
A [Editorconfig][editorconfig] file parser and manipulator for Go.
-> This package is already working, but still under testing.
+> Currently this package does some basic work but does not fully support
+> EditorConfig specs, so using it in "real world" is not recommended.
-## Installing
+## Missing features
-We recommend the use of [gopkg.in][gopkg] for this package:
+- `unset`
+- escaping comments in values, probably in [go-ini/ini](https://github.com/go-ini/ini)
-```bash
-go get -u gopkg.in/editorconfig/editorconfig-core-go.v1
-```
+## Installing
+
+We recommend the use of Go 1.11+ modules for this package.
Import by the same path. The package name you will use to access it is
`editorconfig`.
```go
import (
- "gopkg.in/editorconfig/editorconfig-core-go.v1"
+ "github.com/editorconfig/editorconfig-core-go/v2"
)
```
@@ -70,6 +73,7 @@ type Definition struct {
EndOfLine string
TrimTrailingWhitespace bool
InsertFinalNewline bool
+ Raw map[string]string
}
```
@@ -115,8 +119,7 @@ if err != nil {
To run the tests:
```bash
-go test -v
+go test -v ./...
```
[editorconfig]: http://editorconfig.org/
-[gopkg]: https://gopkg.in
diff --git a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/editorconfig.go b/vendor/github.com/editorconfig/editorconfig-core-go/v2/editorconfig.go
index d9d629f143..1122612b49 100644
--- a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/editorconfig.go
+++ b/vendor/github.com/editorconfig/editorconfig-core-go/v2/editorconfig.go
@@ -15,6 +15,7 @@ import (
)
const (
+ // ConfigNameDefault represents the name of the configuration file
ConfigNameDefault = ".editorconfig"
)
@@ -37,6 +38,7 @@ const (
CharsetUTF8 = "utf-8"
CharsetUTF16BE = "utf-16be"
CharsetUTF16LE = "utf-16le"
+ CharsetUTF8BOM = "utf-8 bom"
)
// Definition represents a definition inside the .editorconfig file.
@@ -81,28 +83,21 @@ func ParseBytes(data []byte) (*Editorconfig, error) {
var (
iniSection = iniFile.Section(sectionStr)
definition = &Definition{}
- raw = make(map[string]string)
+ raw = make(map[string]string)
)
err := iniSection.MapTo(&definition)
if err != nil {
return nil, err
}
- // tab_width defaults to indent_size:
- // https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#tab_width
- if definition.TabWidth <= 0 {
- if num, err := strconv.Atoi(definition.IndentSize); err == nil {
- definition.TabWidth = num
- }
- }
-
// Shallow copy all properties
for k, v := range iniSection.KeysHash() {
- raw[k] = v
+ raw[strings.ToLower(k)] = v
}
definition.Selector = sectionStr
definition.Raw = raw
+ definition.normalize()
editorConfig.Definitions = append(editorConfig.Definitions, definition)
}
return editorConfig, nil
@@ -122,44 +117,18 @@ var (
regexpBraces = regexp.MustCompile("{.*}")
)
-func filenameMatches(pattern, name string) bool {
- // basic match
- matched, _ := filepath.Match(pattern, name)
- if matched {
- return true
- }
- // foo/bar/main.go should match main.go
- matched, _ = filepath.Match(pattern, filepath.Base(name))
- if matched {
- return true
- }
- // foo should match foo/main.go
- matched, _ = filepath.Match(filepath.Join(pattern, "*"), name)
- if matched {
- return true
- }
- // *.{js,go} should match main.go
- if str := regexpBraces.FindString(pattern); len(str) > 0 {
- // remote initial "{" and final "}"
- str = strings.TrimPrefix(str, "{")
- str = strings.TrimSuffix(str, "}")
-
- // testing for empty brackets: "{}"
- if len(str) == 0 {
- patt := regexpBraces.ReplaceAllString(pattern, "*")
- matched, _ = filepath.Match(patt, filepath.Base(name))
- return matched
- }
+// normalize fixes some values to their lowercaes value
+func (d *Definition) normalize() {
+ d.Charset = strings.ToLower(d.Charset)
+ d.EndOfLine = strings.ToLower(d.EndOfLine)
+ d.IndentStyle = strings.ToLower(d.IndentStyle)
- for _, patt := range strings.Split(str, ",") {
- patt = regexpBraces.ReplaceAllString(pattern, patt)
- matched, _ = filepath.Match(patt, filepath.Base(name))
- if matched {
- return true
- }
- }
+ // tab_width defaults to indent_size:
+ // https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#tab_width
+ num, err := strconv.Atoi(d.IndentSize)
+ if err == nil && d.TabWidth <= 0 {
+ d.TabWidth = num
}
- return false
}
func (d *Definition) merge(md *Definition) {
@@ -192,26 +161,71 @@ func (d *Definition) merge(md *Definition) {
}
}
+// InsertToIniFile ... TODO
func (d *Definition) InsertToIniFile(iniFile *ini.File) {
iniSec := iniFile.Section(d.Selector)
for k, v := range d.Raw {
- iniSec.Key(k).SetValue(v)
+ if k == "insert_final_newline" {
+ iniSec.Key(k).SetValue(strconv.FormatBool(d.InsertFinalNewline))
+ } else if k == "trim_trailing_whitespace" {
+ iniSec.Key(k).SetValue(strconv.FormatBool(d.TrimTrailingWhitespace))
+ } else if k == "charset" {
+ iniSec.Key(k).SetValue(d.Charset)
+ } else if k == "end_of_line" {
+ iniSec.Key(k).SetValue(d.EndOfLine)
+ } else if k == "indent_style" {
+ iniSec.Key(k).SetValue(d.IndentStyle)
+ } else if k == "tab_width" {
+ iniSec.Key(k).SetValue(strconv.Itoa(d.TabWidth))
+ } else if k == "indent_size" {
+ iniSec.Key(k).SetValue(d.IndentSize)
+ } else {
+ iniSec.Key(k).SetValue(v)
+ }
+ }
+ if _, ok := d.Raw["indent_size"]; !ok {
+ if d.TabWidth > 0 {
+ iniSec.Key("indent_size").SetValue(strconv.Itoa(d.TabWidth))
+ } else if d.IndentStyle == IndentStyleTab {
+ iniSec.Key("indent_size").SetValue(IndentStyleTab)
+ }
+ }
+
+ if _, ok := d.Raw["tab_width"]; !ok && len(d.IndentSize) > 0 {
+ if _, err := strconv.Atoi(d.IndentSize); err == nil {
+ iniSec.Key("tab_width").SetValue(d.IndentSize)
+ }
}
}
// GetDefinitionForFilename returns a definition for the given filename.
// The result is a merge of the selectors that matched the file.
// The last section has preference over the priors.
-func (e *Editorconfig) GetDefinitionForFilename(name string) *Definition {
+func (e *Editorconfig) GetDefinitionForFilename(name string) (*Definition, error) {
def := &Definition{}
def.Raw = make(map[string]string)
for i := len(e.Definitions) - 1; i >= 0; i-- {
actualDef := e.Definitions[i]
- if filenameMatches(actualDef.Selector, name) {
+ selector := actualDef.Selector
+ if !strings.HasPrefix(selector, "/") {
+ if strings.ContainsRune(selector, '/') {
+ selector = "/" + selector
+ } else {
+ selector = "/**/" + selector
+ }
+ }
+ if !strings.HasPrefix(name, "/") {
+ name = "/" + name
+ }
+ ok, err := FnmatchCase(selector, name)
+ if err != nil {
+ return nil, err
+ }
+ if ok {
def.merge(actualDef)
}
}
- return def
+ return def, nil
}
func boolToString(b bool) string {
@@ -279,10 +293,23 @@ func GetDefinitionForFilenameWithConfigname(filename string, configname string)
if err != nil {
return nil, err
}
- definition.merge(ec.GetDefinitionForFilename(filename))
+
+ relativeFilename := filename
+ if len(dir) < len(abs) {
+ relativeFilename = abs[len(dir):]
+ }
+
+ def, err := ec.GetDefinitionForFilename(relativeFilename)
+ if err != nil {
+ return nil, err
+ }
+
+ definition.merge(def)
+
if ec.Root {
break
}
}
+
return definition, nil
}
diff --git a/vendor/github.com/editorconfig/editorconfig-core-go/v2/fnmatch.go b/vendor/github.com/editorconfig/editorconfig-core-go/v2/fnmatch.go
new file mode 100644
index 0000000000..c33544cf78
--- /dev/null
+++ b/vendor/github.com/editorconfig/editorconfig-core-go/v2/fnmatch.go
@@ -0,0 +1,177 @@
+package editorconfig
+
+import (
+ "fmt"
+ "regexp"
+ "strconv"
+ "strings"
+)
+
+var (
+ // findLeftBrackets matches the opening left bracket {
+ findLeftBrackets = regexp.MustCompile(`(^|[^\\])\{`)
+ // findLeftBrackets matches the closing right bracket {
+ findRightBrackets = regexp.MustCompile(`(^|[^\\])\}`)
+ // findNumericRange matches a range of number, e.g. -2..5
+ findNumericRange = regexp.MustCompile(`^([+-]?\d+)\.\.([+-]?\d+)$`)
+)
+
+// FnmatchCase tests whether the name matches the given pattern case included.
+func FnmatchCase(pattern, name string) (bool, error) {
+ p, err := translate(pattern)
+ if err != nil {
+ return false, err
+ }
+
+ r, err := regexp.Compile(fmt.Sprintf("^%s$", p))
+ if err != nil {
+ return false, err
+ }
+
+ return r.MatchString(name), nil
+}
+
+func translate(pattern string) (string, error) {
+ index := 0
+ pat := []rune(pattern)
+ length := len(pat)
+
+ result := strings.Builder{}
+
+ braceLevel := 0
+ isEscaped := false
+ inBrackets := false
+
+ matchesBraces := len(findLeftBrackets.FindAllString(pattern, -1)) == len(findRightBrackets.FindAllString(pattern, -1))
+
+ for index < length {
+ r := pat[index]
+ index++
+
+ if r == '*' {
+ p := index
+ if p < length && pat[p] == '*' {
+ result.WriteString(".*")
+ index++
+ } else {
+ result.WriteString("[^/]*")
+ }
+ } else if r == '/' {
+ p := index
+ if p+2 < length && pat[p] == '*' && pat[p+1] == '*' && pat[p+2] == '/' {
+ result.WriteString("(?:/|/.*/)")
+ index += 3
+ } else {
+ result.WriteRune(r)
+ }
+ } else if r == '?' {
+ result.WriteString("[^/]")
+ } else if r == '[' {
+ if inBrackets {
+ result.WriteString("\\[")
+ } else {
+ hasSlash := false
+ res := strings.Builder{}
+
+ p := index
+ for p < length {
+ if pat[p] == ']' && pat[p-1] != '\\' {
+ break
+ }
+ res.WriteRune(pat[p])
+ if pat[p] == '/' && pat[p-1] != '\\' {
+ hasSlash = true
+ break
+ }
+ p++
+ }
+ if hasSlash {
+ result.WriteString("\\[" + res.String())
+ index = p + 1
+ } else {
+ inBrackets = true
+ if index < length && pat[index] == '!' || pat[index] == '^' {
+ index++
+ result.WriteString("[^")
+ } else {
+ result.WriteRune('[')
+ }
+ }
+ }
+ } else if r == ']' {
+ if inBrackets && pat[index-2] == '\\' {
+ result.WriteString("\\]")
+ } else {
+ result.WriteRune(r)
+ inBrackets = false
+ }
+ } else if r == '{' {
+ hasComma := false
+ p := index
+ res := strings.Builder{}
+
+ for p < length {
+ if pat[p] == '}' && pat[p-1] != '\\' {
+ break
+ }
+ res.WriteRune(pat[p])
+ if pat[p] == ',' && pat[p-1] != '\\' {
+ hasComma = true
+ break
+ }
+ p++
+ }
+
+ if !hasComma && p < length {
+ inner := res.String()
+ sub := findNumericRange.FindStringSubmatch(inner)
+ if len(sub) == 3 {
+ from, _ := strconv.Atoi(sub[1])
+ to, _ := strconv.Atoi(sub[2])
+ result.WriteString("(?:")
+ // XXX does not scale well
+ for i := from; i < to; i++ {
+ result.WriteString(strconv.Itoa(i))
+ result.WriteRune('|')
+ }
+ result.WriteString(strconv.Itoa(to))
+ result.WriteRune(')')
+ } else {
+ r, _ := translate(inner)
+ result.WriteString(fmt.Sprintf("\\{%s\\}", r))
+ }
+ index = p + 1
+ } else if matchesBraces {
+ result.WriteString("(?:")
+ braceLevel++
+ } else {
+ result.WriteString("\\{")
+ }
+ } else if r == '}' {
+ if braceLevel > 0 {
+ if isEscaped {
+ result.WriteRune('}')
+ isEscaped = false
+ } else {
+ result.WriteRune(')')
+ braceLevel--
+ }
+ } else {
+ result.WriteString("\\}")
+ }
+ } else if r == ',' {
+ if braceLevel == 0 || isEscaped {
+ result.WriteRune(r)
+ } else {
+ result.WriteRune('|')
+ }
+ } else if r != '\\' || isEscaped {
+ result.WriteString(regexp.QuoteMeta(string(r)))
+ isEscaped = false
+ } else {
+ isEscaped = true
+ }
+ }
+
+ return result.String(), nil
+}
diff --git a/vendor/github.com/editorconfig/editorconfig-core-go/v2/go.mod b/vendor/github.com/editorconfig/editorconfig-core-go/v2/go.mod
new file mode 100644
index 0000000000..e4364b8b45
--- /dev/null
+++ b/vendor/github.com/editorconfig/editorconfig-core-go/v2/go.mod
@@ -0,0 +1,9 @@
+module github.com/editorconfig/editorconfig-core-go/v2
+
+go 1.12
+
+require (
+ github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a // indirect
+ github.com/stretchr/testify v1.3.0
+ gopkg.in/ini.v1 v1.42.0
+)
diff --git a/vendor/github.com/editorconfig/editorconfig-core-go/v2/go.sum b/vendor/github.com/editorconfig/editorconfig-core-go/v2/go.sum
new file mode 100644
index 0000000000..061cdf586b
--- /dev/null
+++ b/vendor/github.com/editorconfig/editorconfig-core-go/v2/go.sum
@@ -0,0 +1,22 @@
+github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
+github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
+github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
+github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
+github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
+github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs=
+github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+gopkg.in/ini.v1 v1.42.0 h1:7N3gPTt50s8GuLortA00n8AqRTk75qOP98+mTPpgzRk=
+gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
diff --git a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitattributes b/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitattributes
deleted file mode 100644
index d7f0d87596..0000000000
--- a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitattributes
+++ /dev/null
@@ -1,5 +0,0 @@
-* text eol=lf
-*.jpg binary
-*.jpeg binary
-*.png binary
-*.ico binary
diff --git a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.travis.yml b/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.travis.yml
deleted file mode 100644
index a3183d6a78..0000000000
--- a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.travis.yml
+++ /dev/null
@@ -1,14 +0,0 @@
----
-language: go
-sudo: false
-go:
- - '1.8'
- - '1.9'
- - '1.10'
-go_import_path: gopkg.in/editorconfig/editorconfig-core-go.v1
-
-install:
- - make installdeps
-
-script:
- - make test
diff --git a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/Makefile b/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/Makefile
deleted file mode 100644
index 5151ed818d..0000000000
--- a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-PROJECT_ROOT_DIR := $(CURDIR)
-SRC := editorconfig.go cmd/editorconfig/main.go
-
-.PHONY: bin test test-go test-core submodule installdeps
-
-test: test-go test-core
-
-submodule:
- git submodule update --init
-
-installdeps:
- go get -t ./...
-
-editorconfig: $(SRC)
- go build ./cmd/editorconfig
-
-test-go:
- go test -v
-
-test-core: editorconfig
- cd $(PROJECT_ROOT_DIR)/core-test && \
- cmake -DEDITORCONFIG_CMD="$(PROJECT_ROOT_DIR)/editorconfig" .
-# Temporarily disable core-test
- # cd $(PROJECT_ROOT_DIR)/core-test && \
- # ctest --output-on-failure .
diff --git a/vendor/modules.txt b/vendor/modules.txt
index cda2acf0ee..91f7fce0d9 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -119,6 +119,8 @@ github.com/denisenkom/go-mssqldb/internal/decimal
github.com/denisenkom/go-mssqldb/internal/querytext
# github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/dgrijalva/jwt-go
+# github.com/editorconfig/editorconfig-core-go/v2 v2.1.1
+github.com/editorconfig/editorconfig-core-go/v2
# github.com/edsrzf/mmap-go v1.0.0
github.com/edsrzf/mmap-go
# github.com/emirpasic/gods v1.12.0
@@ -537,8 +539,6 @@ google.golang.org/appengine/urlfetch
gopkg.in/alexcesaro/quotedprintable.v3
# gopkg.in/asn1-ber.v1 v1.0.0-20150924051756-4e86f4367175
gopkg.in/asn1-ber.v1
-# gopkg.in/editorconfig/editorconfig-core-go.v1 v1.3.0
-gopkg.in/editorconfig/editorconfig-core-go.v1
# gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gopkg.in/gomail.v2
# gopkg.in/ini.v1 v1.48.0