From 52feff5a5c76421fe90c8e6a62ec86eaaa4634f2 Mon Sep 17 00:00:00 2001 From: Antoine GIRARD Date: Mon, 5 Aug 2019 09:52:41 +0200 Subject: [PATCH] deps: Upgrade gopkg.in/editorconfig/editorconfig-core-go.v1 (#7749) * deps: Upgrade gopkg.in/editorconfig/editorconfig-core-go.v1 from 1.2.0 to 1.3.0 * deps: vendor updates --- go.mod | 2 +- go.sum | 4 +- .../editorconfig-core-go.v1/.editorconfig | 2 +- .../editorconfig-core-go.v1/.gitignore | 3 + .../editorconfig-core-go.v1/.gitmodules | 3 + .../editorconfig-core-go.v1/.travis.yml | 14 +++++ .../editorconfig-core-go.v1/Makefile | 25 ++++++++ .../editorconfig-core-go.v1/README.md | 3 +- .../editorconfig-core-go.v1/editorconfig.go | 57 +++++++++++-------- vendor/modules.txt | 2 +- 10 files changed, 86 insertions(+), 29 deletions(-) create mode 100644 vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitmodules create mode 100644 vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.travis.yml create mode 100644 vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/Makefile diff --git a/go.mod b/go.mod index 9bf380007708..804573e0d7bf 100644 --- a/go.mod +++ b/go.mod @@ -115,7 +115,7 @@ require ( gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/asn1-ber.v1 v1.0.0-20150924051756-4e86f4367175 // indirect gopkg.in/bufio.v1 v1.0.0-20140618132640-567b2bfa514e // indirect - gopkg.in/editorconfig/editorconfig-core-go.v1 v1.2.0 + gopkg.in/editorconfig/editorconfig-core-go.v1 v1.3.0 gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df gopkg.in/ini.v1 v1.42.0 gopkg.in/ldap.v3 v3.0.2 diff --git a/go.sum b/go.sum index a3adcc180349..89a2362e9657 100644 --- a/go.sum +++ b/go.sum @@ -451,8 +451,8 @@ gopkg.in/bufio.v1 v1.0.0-20140618132640-567b2bfa514e/go.mod h1:xsQCaysVCudhrYTfz gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/editorconfig/editorconfig-core-go.v1 v1.2.0 h1:CO465/foR4+bY1xNYjZEl6l8By1g/iMsImoruxfEt84= -gopkg.in/editorconfig/editorconfig-core-go.v1 v1.2.0/go.mod h1:s2mQFI9McjArkyCwyEwU//+luQENTnD/Lfb/7Sj3/kQ= +gopkg.in/editorconfig/editorconfig-core-go.v1 v1.3.0 h1:oxOEwvhxLMpWpN+0pb2r9TWrM0DCFBHxbuIlS27tmFg= +gopkg.in/editorconfig/editorconfig-core-go.v1 v1.3.0/go.mod h1:s2mQFI9McjArkyCwyEwU//+luQENTnD/Lfb/7Sj3/kQ= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE= diff --git a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.editorconfig b/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.editorconfig index c3bc90e1d01c..715e21f1de6d 100644 --- a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.editorconfig +++ b/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.editorconfig @@ -10,4 +10,4 @@ trim_trailing_whitespace = true [*.go] indent_style = tab -indent_size = 4 +indent_size = 8 diff --git a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitignore b/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitignore index d3beee5771a8..f5dcd260833a 100644 --- a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitignore +++ b/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitignore @@ -24,3 +24,6 @@ _testmain.go *.test *.prof +# EditorConfig + +/editorconfig diff --git a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitmodules b/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitmodules new file mode 100644 index 000000000000..9e75e1ca0b25 --- /dev/null +++ b/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.gitmodules @@ -0,0 +1,3 @@ +[submodule "core-test"] + path = core-test + url = https://github.com/editorconfig/editorconfig-core-test.git diff --git a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.travis.yml b/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.travis.yml new file mode 100644 index 000000000000..a3183d6a781e --- /dev/null +++ b/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/.travis.yml @@ -0,0 +1,14 @@ +--- +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 new file mode 100644 index 000000000000..5151ed818d92 --- /dev/null +++ b/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/Makefile @@ -0,0 +1,25 @@ +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/gopkg.in/editorconfig/editorconfig-core-go.v1/README.md b/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/README.md index 4a57ec133d8c..e060f1061f39 100644 --- a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/README.md +++ b/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/README.md @@ -1,3 +1,4 @@ +[![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) @@ -15,7 +16,7 @@ We recommend the use of [gopkg.in][gopkg] for this package: go get -u gopkg.in/editorconfig/editorconfig-core-go.v1 ``` -Import by the same path. Tha package name you will use to access it is +Import by the same path. The package name you will use to access it is `editorconfig`. ```go diff --git a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/editorconfig.go b/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/editorconfig.go index 6291af5759d5..d9d629f143bd 100644 --- a/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/editorconfig.go +++ b/vendor/gopkg.in/editorconfig/editorconfig-core-go.v1/editorconfig.go @@ -14,6 +14,10 @@ import ( "gopkg.in/ini.v1" ) +const ( + ConfigNameDefault = ".editorconfig" +) + // IndentStyle possible values const ( IndentStyleTab = "tab" @@ -49,6 +53,8 @@ type Definition struct { EndOfLine string `ini:"end_of_line" json:"end_of_line,omitempty"` TrimTrailingWhitespace bool `ini:"trim_trailing_whitespace" json:"trim_trailing_whitespace,omitempty"` InsertFinalNewline bool `ini:"insert_final_newline" json:"insert_final_newline,omitempty"` + + Raw map[string]string `ini:"-" json:"-"` } // Editorconfig represents a .editorconfig file. @@ -75,6 +81,7 @@ func ParseBytes(data []byte) (*Editorconfig, error) { var ( iniSection = iniFile.Section(sectionStr) definition = &Definition{} + raw = make(map[string]string) ) err := iniSection.MapTo(&definition) if err != nil { @@ -89,7 +96,13 @@ func ParseBytes(data []byte) (*Editorconfig, error) { } } + // Shallow copy all properties + for k, v := range iniSection.KeysHash() { + raw[k] = v + } + definition.Selector = sectionStr + definition.Raw = raw editorConfig.Definitions = append(editorConfig.Definitions, definition) } return editorConfig, nil @@ -171,6 +184,19 @@ func (d *Definition) merge(md *Definition) { if !d.InsertFinalNewline { d.InsertFinalNewline = md.InsertFinalNewline } + + for k, v := range md.Raw { + if _, ok := d.Raw[k]; !ok { + d.Raw[k] = v + } + } +} + +func (d *Definition) InsertToIniFile(iniFile *ini.File) { + iniSec := iniFile.Section(d.Selector) + for k, v := range d.Raw { + iniSec.Key(k).SetValue(v) + } } // GetDefinitionForFilename returns a definition for the given filename. @@ -178,6 +204,7 @@ func (d *Definition) merge(md *Definition) { // The last section has preference over the priors. func (e *Editorconfig) GetDefinitionForFilename(name string) *Definition { 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) { @@ -206,28 +233,7 @@ func (e *Editorconfig) Serialize() ([]byte, error) { iniFile.Section(ini.DEFAULT_SECTION).Key("root").SetValue(boolToString(e.Root)) } for _, d := range e.Definitions { - iniSec := iniFile.Section(d.Selector) - if len(d.Charset) > 0 { - iniSec.Key("charset").SetValue(d.Charset) - } - if len(d.IndentStyle) > 0 { - iniSec.Key("indent_style").SetValue(d.IndentStyle) - } - if len(d.IndentSize) > 0 { - iniSec.Key("indent_size").SetValue(d.IndentSize) - } - if d.TabWidth > 0 && strconv.Itoa(d.TabWidth) != d.IndentSize { - iniSec.Key("tab_width").SetValue(strconv.Itoa(d.TabWidth)) - } - if len(d.EndOfLine) > 0 { - iniSec.Key("end_of_line").SetValue(d.EndOfLine) - } - if d.TrimTrailingWhitespace { - iniSec.Key("trim_trailing_whitespace").SetValue(boolToString(d.TrimTrailingWhitespace)) - } - if d.InsertFinalNewline { - iniSec.Key("insert_final_newline").SetValue(boolToString(d.InsertFinalNewline)) - } + d.InsertToIniFile(iniFile) } _, err := iniFile.WriteTo(buffer) if err != nil { @@ -251,16 +257,21 @@ func (e *Editorconfig) Save(filename string) error { // folder with `root = true`, and returns the right editorconfig // definition for the given file. func GetDefinitionForFilename(filename string) (*Definition, error) { + return GetDefinitionForFilenameWithConfigname(filename, ConfigNameDefault) +} + +func GetDefinitionForFilenameWithConfigname(filename string, configname string) (*Definition, error) { abs, err := filepath.Abs(filename) if err != nil { return nil, err } definition := &Definition{} + definition.Raw = make(map[string]string) dir := abs for dir != filepath.Dir(dir) { dir = filepath.Dir(dir) - ecFile := filepath.Join(dir, ".editorconfig") + ecFile := filepath.Join(dir, configname) if _, err := os.Stat(ecFile); os.IsNotExist(err) { continue } diff --git a/vendor/modules.txt b/vendor/modules.txt index 3f74ea6721d8..187d128d7f13 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -414,7 +414,7 @@ gopkg.in/alexcesaro/quotedprintable.v3 gopkg.in/asn1-ber.v1 # gopkg.in/bufio.v1 v1.0.0-20140618132640-567b2bfa514e gopkg.in/bufio.v1 -# gopkg.in/editorconfig/editorconfig-core-go.v1 v1.2.0 +# 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