From 7b4377ad9d8a7205416df8d6217ef2b010f89481 Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Wed, 22 Jan 2025 16:07:17 +0100 Subject: vendor: delete --- vendor/github.com/ldez/gomoddirectives/.gitignore | 2 - .../github.com/ldez/gomoddirectives/.golangci.yml | 102 ---------- vendor/github.com/ldez/gomoddirectives/LICENSE | 190 ------------------ vendor/github.com/ldez/gomoddirectives/Makefile | 15 -- .../ldez/gomoddirectives/gomoddirectives.go | 125 ------------ vendor/github.com/ldez/gomoddirectives/module.go | 48 ----- vendor/github.com/ldez/gomoddirectives/readme.md | 16 -- vendor/github.com/ldez/tagliatelle/.gitignore | 3 - vendor/github.com/ldez/tagliatelle/.golangci.yml | 88 --------- vendor/github.com/ldez/tagliatelle/LICENSE | 190 ------------------ vendor/github.com/ldez/tagliatelle/Makefile | 15 -- vendor/github.com/ldez/tagliatelle/readme.md | 177 ----------------- vendor/github.com/ldez/tagliatelle/tagliatelle.go | 218 --------------------- 13 files changed, 1189 deletions(-) delete mode 100644 vendor/github.com/ldez/gomoddirectives/.gitignore delete mode 100644 vendor/github.com/ldez/gomoddirectives/.golangci.yml delete mode 100644 vendor/github.com/ldez/gomoddirectives/LICENSE delete mode 100644 vendor/github.com/ldez/gomoddirectives/Makefile delete mode 100644 vendor/github.com/ldez/gomoddirectives/gomoddirectives.go delete mode 100644 vendor/github.com/ldez/gomoddirectives/module.go delete mode 100644 vendor/github.com/ldez/gomoddirectives/readme.md delete mode 100644 vendor/github.com/ldez/tagliatelle/.gitignore delete mode 100644 vendor/github.com/ldez/tagliatelle/.golangci.yml delete mode 100644 vendor/github.com/ldez/tagliatelle/LICENSE delete mode 100644 vendor/github.com/ldez/tagliatelle/Makefile delete mode 100644 vendor/github.com/ldez/tagliatelle/readme.md delete mode 100644 vendor/github.com/ldez/tagliatelle/tagliatelle.go (limited to 'vendor/github.com/ldez') diff --git a/vendor/github.com/ldez/gomoddirectives/.gitignore b/vendor/github.com/ldez/gomoddirectives/.gitignore deleted file mode 100644 index 9da3e0da9..000000000 --- a/vendor/github.com/ldez/gomoddirectives/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.idea/ -/gomoddirectives diff --git a/vendor/github.com/ldez/gomoddirectives/.golangci.yml b/vendor/github.com/ldez/gomoddirectives/.golangci.yml deleted file mode 100644 index 034745570..000000000 --- a/vendor/github.com/ldez/gomoddirectives/.golangci.yml +++ /dev/null @@ -1,102 +0,0 @@ -run: - timeout: 2m - -linters-settings: - govet: - enable-all: true - gocyclo: - min-complexity: 12 - goconst: - min-len: 3 - min-occurrences: 3 - misspell: - locale: US - gofumpt: - extra-rules: true - depguard: - rules: - main: - deny: - - pkg: "github.com/instana/testify" - desc: not allowed - - pkg: "github.com/pkg/errors" - desc: Should be replaced by standard lib errors package - godox: - keywords: - - FIXME - gocritic: - enabled-tags: - - diagnostic - - style - - performance - disabled-checks: - - sloppyReassign - - rangeValCopy - - octalLiteral - - paramTypeCombine # already handle by gofumpt.extra-rules - settings: - hugeParam: - sizeThreshold: 100 - forbidigo: - forbid: - - '^print(ln)?$' - - '^fmt\.Print(f|ln)?$' - - '^panic$' - - '^spew\.Print(f|ln)?$' - - '^spew\.Dump$' - tagliatelle: - case: - rules: - json: pascal - -linters: - enable-all: true - disable: - - deadcode # deprecated - - exhaustivestruct # deprecated - - golint # deprecated - - ifshort # deprecated - - interfacer # deprecated - - maligned # deprecated - - nosnakecase # deprecated - - scopelint # deprecated - - structcheck # deprecated - - varcheck # deprecated - - sqlclosecheck # not relevant (SQL) - - rowserrcheck # not relevant (SQL) - - execinquery # not relevant (SQL) - - cyclop # duplicate of gocyclo - - lll - - dupl - - prealloc - - bodyclose - - wsl - - nlreturn - - gomnd - - testpackage - - paralleltest - - tparallel - - goerr113 - - wrapcheck - - exhaustive - - exhaustruct - - varnamelen - -issues: - exclude-use-default: false - max-issues-per-linter: 0 - max-same-issues: 0 - exclude: [ - 'package-comments: should have a package comment' - ] - exclude-rules: - - path: "(.+)_test.go" - linters: - - funlen - - goconst - - path: cmd/gomoddirectives/gomoddirectives.go - text: 'use of `fmt.Println` forbidden' - -output: - show-stats: true - sort-results: true diff --git a/vendor/github.com/ldez/gomoddirectives/LICENSE b/vendor/github.com/ldez/gomoddirectives/LICENSE deleted file mode 100644 index caed523b4..000000000 --- a/vendor/github.com/ldez/gomoddirectives/LICENSE +++ /dev/null @@ -1,190 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2021 Fernandez Ludovic - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/ldez/gomoddirectives/Makefile b/vendor/github.com/ldez/gomoddirectives/Makefile deleted file mode 100644 index 5a0a852c8..000000000 --- a/vendor/github.com/ldez/gomoddirectives/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -.PHONY: clean check test build - -default: clean check test build - -clean: - rm -rf dist/ cover.out - -test: clean - go test -v -cover ./... - -check: - golangci-lint run - -build: - go build -ldflags "-s -w" -trimpath ./cmd/gomoddirectives/ diff --git a/vendor/github.com/ldez/gomoddirectives/gomoddirectives.go b/vendor/github.com/ldez/gomoddirectives/gomoddirectives.go deleted file mode 100644 index 2a4c90474..000000000 --- a/vendor/github.com/ldez/gomoddirectives/gomoddirectives.go +++ /dev/null @@ -1,125 +0,0 @@ -// Package gomoddirectives a linter that handle `replace`, `retract`, `exclude` directives into `go.mod`. -package gomoddirectives - -import ( - "fmt" - "go/token" - "strings" - - "golang.org/x/mod/modfile" -) - -const ( - reasonRetract = "a comment is mandatory to explain why the version has been retracted" - reasonExclude = "exclude directive is not allowed" - reasonReplaceLocal = "local replacement are not allowed" - reasonReplace = "replacement are not allowed" - reasonReplaceIdentical = "the original module and the replacement are identical" - reasonReplaceDuplicate = "multiple replacement of the same module" -) - -// Result the analysis result. -type Result struct { - Reason string - Start token.Position - End token.Position -} - -// NewResult creates a new Result. -func NewResult(file *modfile.File, line *modfile.Line, reason string) Result { - return Result{ - Start: token.Position{Filename: file.Syntax.Name, Line: line.Start.Line, Column: line.Start.LineRune}, - End: token.Position{Filename: file.Syntax.Name, Line: line.End.Line, Column: line.End.LineRune}, - Reason: reason, - } -} - -func (r Result) String() string { - return fmt.Sprintf("%s: %s", r.Start, r.Reason) -} - -// Options the analyzer options. -type Options struct { - ReplaceAllowList []string - ReplaceAllowLocal bool - ExcludeForbidden bool - RetractAllowNoExplanation bool -} - -// Analyze analyzes a project. -func Analyze(opts Options) ([]Result, error) { - f, err := GetModuleFile() - if err != nil { - return nil, fmt.Errorf("failed to get module file: %w", err) - } - - return AnalyzeFile(f, opts), nil -} - -// AnalyzeFile analyzes a mod file. -func AnalyzeFile(file *modfile.File, opts Options) []Result { - var results []Result - - if !opts.RetractAllowNoExplanation { - for _, r := range file.Retract { - if r.Rationale != "" { - continue - } - - results = append(results, NewResult(file, r.Syntax, reasonRetract)) - } - } - - if opts.ExcludeForbidden { - for _, e := range file.Exclude { - results = append(results, NewResult(file, e.Syntax, reasonExclude)) - } - } - - uniqReplace := map[string]struct{}{} - - for _, r := range file.Replace { - reason := check(opts, r) - if reason != "" { - results = append(results, NewResult(file, r.Syntax, reason)) - continue - } - - if r.Old.Path == r.New.Path && r.Old.Version == r.New.Version { - results = append(results, NewResult(file, r.Syntax, reasonReplaceIdentical)) - continue - } - - if _, ok := uniqReplace[r.Old.Path+r.Old.Version]; ok { - results = append(results, NewResult(file, r.Syntax, reasonReplaceDuplicate)) - } - - uniqReplace[r.Old.Path+r.Old.Version] = struct{}{} - } - - return results -} - -func check(o Options, r *modfile.Replace) string { - if isLocal(r) { - if o.ReplaceAllowLocal { - return "" - } - - return fmt.Sprintf("%s: %s", reasonReplaceLocal, r.Old.Path) - } - - for _, v := range o.ReplaceAllowList { - if r.Old.Path == v { - return "" - } - } - - return fmt.Sprintf("%s: %s", reasonReplace, r.Old.Path) -} - -// Filesystem paths found in "replace" directives are represented by a path with an empty version. -// https://github.com/golang/mod/blob/bc388b264a244501debfb9caea700c6dcaff10e2/module/module.go#L122-L124 -func isLocal(r *modfile.Replace) bool { - return strings.TrimSpace(r.New.Version) == "" -} diff --git a/vendor/github.com/ldez/gomoddirectives/module.go b/vendor/github.com/ldez/gomoddirectives/module.go deleted file mode 100644 index 4cb365379..000000000 --- a/vendor/github.com/ldez/gomoddirectives/module.go +++ /dev/null @@ -1,48 +0,0 @@ -package gomoddirectives - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "os" - "os/exec" - - "golang.org/x/mod/modfile" -) - -type modInfo struct { - Path string `json:"Path"` - Dir string `json:"Dir"` - GoMod string `json:"GoMod"` - GoVersion string `json:"GoVersion"` - Main bool `json:"Main"` -} - -// GetModuleFile gets module file. -func GetModuleFile() (*modfile.File, error) { - // https://github.com/golang/go/issues/44753#issuecomment-790089020 - cmd := exec.Command("go", "list", "-m", "-json") - - raw, err := cmd.Output() - if err != nil { - return nil, fmt.Errorf("command go list: %w: %s", err, string(raw)) - } - - var v modInfo - err = json.NewDecoder(bytes.NewBuffer(raw)).Decode(&v) - if err != nil { - return nil, fmt.Errorf("unmarshaling error: %w: %s", err, string(raw)) - } - - if v.GoMod == "" { - return nil, errors.New("working directory is not part of a module") - } - - raw, err = os.ReadFile(v.GoMod) - if err != nil { - return nil, fmt.Errorf("reading go.mod file: %w", err) - } - - return modfile.Parse("go.mod", raw, nil) -} diff --git a/vendor/github.com/ldez/gomoddirectives/readme.md b/vendor/github.com/ldez/gomoddirectives/readme.md deleted file mode 100644 index 510c8502e..000000000 --- a/vendor/github.com/ldez/gomoddirectives/readme.md +++ /dev/null @@ -1,16 +0,0 @@ -# gomoddirectives - -[![Sponsor](https://img.shields.io/badge/Sponsor%20me-%E2%9D%A4%EF%B8%8F-pink)](https://github.com/sponsors/ldez) -[![Build Status](https://github.com/ldez/gomoddirectives/workflows/Main/badge.svg?branch=master)](https://github.com/ldez/gomoddirectives/actions) - -A linter that handle [`replace`](https://golang.org/ref/mod#go-mod-file-replace), [`retract`](https://golang.org/ref/mod#go-mod-file-retract), [`exclude`](https://golang.org/ref/mod#go-mod-file-exclude) directives into `go.mod`. - -Features: - -- ban all [`replace`](https://golang.org/ref/mod#go-mod-file-replace) directives -- allow only local [`replace`](https://golang.org/ref/mod#go-mod-file-replace) directives -- allow only some [`replace`](https://golang.org/ref/mod#go-mod-file-replace) directives -- force explanation for [`retract`](https://golang.org/ref/mod#go-mod-file-retract) directives -- ban all [`exclude`](https://golang.org/ref/mod#go-mod-file-exclude) directives -- detect duplicated [`replace`](https://golang.org/ref/mod#go-mod-file-replace) directives -- detect identical [`replace`](https://golang.org/ref/mod#go-mod-file-replace) directives diff --git a/vendor/github.com/ldez/tagliatelle/.gitignore b/vendor/github.com/ldez/tagliatelle/.gitignore deleted file mode 100644 index 74c84ce62..000000000 --- a/vendor/github.com/ldez/tagliatelle/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.idea/ -/tagliatelle -notes.md diff --git a/vendor/github.com/ldez/tagliatelle/.golangci.yml b/vendor/github.com/ldez/tagliatelle/.golangci.yml deleted file mode 100644 index ec5c5c766..000000000 --- a/vendor/github.com/ldez/tagliatelle/.golangci.yml +++ /dev/null @@ -1,88 +0,0 @@ -run: - timeout: 5m - skip-files: [ ] - skip-dirs: [ ] - -linters-settings: - govet: - enable-all: true - disable: - - fieldalignment - gocyclo: - min-complexity: 15 - goconst: - min-len: 5 - min-occurrences: 3 - misspell: - locale: US - funlen: - lines: -1 - statements: 40 - godox: - keywords: - - FIXME - gofumpt: - extra-rules: true - depguard: - list-type: denylist - include-go-root: false - packages: - - github.com/sirupsen/logrus - - github.com/pkg/errors - gocritic: - enabled-tags: - - diagnostic - - style - - performance - disabled-checks: - - sloppyReassign - - rangeValCopy - - octalLiteral - - paramTypeCombine # already handle by gofumpt.extra-rules - settings: - hugeParam: - sizeThreshold: 100 - -linters: - enable-all: true - disable: - - deadcode # deprecated - - exhaustivestruct # deprecated - - golint # deprecated - - ifshort # deprecated - - interfacer # deprecated - - maligned # deprecated - - nosnakecase # deprecated - - scopelint # deprecated - - structcheck # deprecated - - varcheck # deprecated - - sqlclosecheck # not relevant (SQL) - - rowserrcheck # not relevant (SQL) - - execinquery # not relevant (SQL) - - cyclop # duplicate of gocyclo - - lll - - dupl - - wsl - - nlreturn - - gomnd - - goerr113 - - wrapcheck - - exhaustive - - exhaustruct - - testpackage - - tparallel - - paralleltest - - prealloc - - ifshort - - forcetypeassert - - varnamelen - - nilnil - - errchkjson - - nonamedreturns - -issues: - exclude-use-default: false - max-per-linter: 0 - max-same-issues: 0 - exclude: - - 'package-comments: should have a package comment' diff --git a/vendor/github.com/ldez/tagliatelle/LICENSE b/vendor/github.com/ldez/tagliatelle/LICENSE deleted file mode 100644 index caed523b4..000000000 --- a/vendor/github.com/ldez/tagliatelle/LICENSE +++ /dev/null @@ -1,190 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2021 Fernandez Ludovic - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/ldez/tagliatelle/Makefile b/vendor/github.com/ldez/tagliatelle/Makefile deleted file mode 100644 index 196f70c02..000000000 --- a/vendor/github.com/ldez/tagliatelle/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -.PHONY: clean check test build - -default: clean check test build - -clean: - rm -rf dist/ cover.out - -test: clean - go test -v -cover ./... - -check: - golangci-lint run - -build: - go build -ldflags "-s -w" -trimpath ./cmd/tagliatelle/ diff --git a/vendor/github.com/ldez/tagliatelle/readme.md b/vendor/github.com/ldez/tagliatelle/readme.md deleted file mode 100644 index 55a544db8..000000000 --- a/vendor/github.com/ldez/tagliatelle/readme.md +++ /dev/null @@ -1,177 +0,0 @@ -# Tagliatelle - -[![Sponsor](https://img.shields.io/badge/Sponsor%20me-%E2%9D%A4%EF%B8%8F-pink)](https://github.com/sponsors/ldez) -[![Build Status](https://github.com/ldez/tagliatelle/workflows/Main/badge.svg?branch=master)](https://github.com/ldez/tagliatelle/actions) - -A linter that handles struct tags. - -Supported string casing: - -- `camel` -- `pascal` -- `kebab` -- `snake` -- `upperSnake` -- `goCamel` Respects [Go's common initialisms](https://github.com/golang/lint/blob/83fdc39ff7b56453e3793356bcff3070b9b96445/lint.go#L770-L809) (e.g. HttpResponse -> HTTPResponse). -- `goPascal` Respects [Go's common initialisms](https://github.com/golang/lint/blob/83fdc39ff7b56453e3793356bcff3070b9b96445/lint.go#L770-L809) (e.g. HttpResponse -> HTTPResponse). -- `goKebab` Respects [Go's common initialisms](https://github.com/golang/lint/blob/83fdc39ff7b56453e3793356bcff3070b9b96445/lint.go#L770-L809) (e.g. HttpResponse -> HTTPResponse). -- `goSnake` Respects [Go's common initialisms](https://github.com/golang/lint/blob/83fdc39ff7b56453e3793356bcff3070b9b96445/lint.go#L770-L809) (e.g. HttpResponse -> HTTPResponse). -- `header` -- `upper` -- `lower` - -| Source | Camel Case | Go Camel Case | -|----------------|----------------|----------------| -| GooID | gooId | gooID | -| HTTPStatusCode | httpStatusCode | httpStatusCode | -| FooBAR | fooBar | fooBar | -| URL | url | url | -| ID | id | id | -| hostIP | hostIp | hostIP | -| JSON | json | json | -| JSONName | jsonName | jsonName | -| NameJSON | nameJson | nameJSON | -| UneTête | uneTête | uneTête | - -| Source | Pascal Case | Go Pascal Case | -|----------------|----------------|----------------| -| GooID | GooId | GooID | -| HTTPStatusCode | HttpStatusCode | HTTPStatusCode | -| FooBAR | FooBar | FooBar | -| URL | Url | URL | -| ID | Id | ID | -| hostIP | HostIp | HostIP | -| JSON | Json | JSON | -| JSONName | JsonName | JSONName | -| NameJSON | NameJson | NameJSON | -| UneTête | UneTête | UneTête | - -| Source | Snake Case | Upper Snake Case | Go Snake Case | -|----------------|------------------|------------------|------------------| -| GooID | goo_id | GOO_ID | goo_ID | -| HTTPStatusCode | http_status_code | HTTP_STATUS_CODE | HTTP_status_code | -| FooBAR | foo_bar | FOO_BAR | foo_bar | -| URL | url | URL | URL | -| ID | id | ID | ID | -| hostIP | host_ip | HOST_IP | host_IP | -| JSON | json | JSON | JSON | -| JSONName | json_name | JSON_NAME | JSON_name | -| NameJSON | name_json | NAME_JSON | name_JSON | -| UneTête | une_tête | UNE_TÊTE | une_tête | - -| Source | Kebab Case | Go KebabCase | -|----------------|------------------|------------------| -| GooID | goo-id | goo-ID | -| HTTPStatusCode | http-status-code | HTTP-status-code | -| FooBAR | foo-bar | foo-bar | -| URL | url | URL | -| ID | id | ID | -| hostIP | host-ip | host-IP | -| JSON | json | JSON | -| JSONName | json-name | JSON-name | -| NameJSON | name-json | name-JSON | -| UneTête | une-tête | une-tête | - -| Source | Header Case | -|----------------|------------------| -| GooID | Goo-Id | -| HTTPStatusCode | Http-Status-Code | -| FooBAR | Foo-Bar | -| URL | Url | -| ID | Id | -| hostIP | Host-Ip | -| JSON | Json | -| JSONName | Json-Name | -| NameJSON | Name-Json | -| UneTête | Une-Tête | - -## Examples - -```go -// json and camel case -type Foo struct { - ID string `json:"ID"` // must be "id" - UserID string `json:"UserID"`// must be "userId" - Name string `json:"name"` - Value string `json:"val,omitempty"`// must be "value" -} -``` - -## What this tool is about - -This tool is about validating tags according to rules you define. -The tool also allows to fix tags according to the rules you defined. - -This tool is not intended to validate the fact a tag in valid or not. -To do that, you can use `go vet`, or use [golangci-lint](https://golangci-lint.run) ["go vet"](https://golangci-lint.run/usage/linters/#govet) linter. - -## How to use the tool - -### As a golangci-lint linter - -Define the rules, you want via your [golangci-lint](https://golangci-lint.run) configuration file: - -```yaml -linters-settings: - tagliatelle: - # Check the struck tag name case. - case: - # Use the struct field name to check the name of the struct tag. - # Default: false - use-field-name: true - rules: - # Any struct tag type can be used. - # Support string case: `camel`, `pascal`, `kebab`, `snake`, `upperSnake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`, `header`. - json: camel - yaml: camel - xml: camel -``` - -More information here https://golangci-lint.run/usage/linters/#tagliatelle - -### Install and run it from the binary - -Not recommended. - -```shell -go install github.com/ldez/tagliatelle/cmd/tagliatelle@latest -``` - -then launch it manually. - -## Rules - -Here are the default rules for the well known and used tags, when using tagliatelle as a binary or [golangci-lint linter](https://golangci-lint.run/usage/linters/#tagliatelle): - -- `json`: `camel` -- `yaml`: `camel` -- `xml`: `camel` -- `bson`: `camel` -- `avro`: `snake` -- `header`: `header` -- `envconfig`: `upperSnake` - -### Custom Rules - -The tool is not limited to the tags used in example, you can use it to validate any tag. - -You can add your own tag, for example `whatever` and tells the tool you want to use `kebab`. - -This option is only available via [golangci-lint](https://golangci-lint.run). - -```yaml -linters-settings: - tagliatelle: - # Check the struck tag name case. - case: - # Use the struct field name to check the name of the struct tag. - # Default: false - use-field-name: true - rules: - # Any struct tag type can be used. - # Support string case: `camel`, `pascal`, `kebab`, `snake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower` - json: camel - yaml: camel - xml: camel - whatever: kebab -``` diff --git a/vendor/github.com/ldez/tagliatelle/tagliatelle.go b/vendor/github.com/ldez/tagliatelle/tagliatelle.go deleted file mode 100644 index 22c5feb3d..000000000 --- a/vendor/github.com/ldez/tagliatelle/tagliatelle.go +++ /dev/null @@ -1,218 +0,0 @@ -// Package tagliatelle a linter that handle struct tags. -package tagliatelle - -import ( - "encoding/json" - "errors" - "fmt" - "go/ast" - "reflect" - "strings" - - "github.com/ettle/strcase" - "golang.org/x/tools/go/analysis" - "golang.org/x/tools/go/analysis/passes/inspect" - "golang.org/x/tools/go/ast/inspector" -) - -// Config the tagliatelle configuration. -type Config struct { - Rules map[string]string - UseFieldName bool -} - -// New creates an analyzer. -func New(config Config) *analysis.Analyzer { - return &analysis.Analyzer{ - Name: "tagliatelle", - Doc: "Checks the struct tags.", - Run: func(pass *analysis.Pass) (interface{}, error) { - if len(config.Rules) == 0 { - return nil, nil - } - - return run(pass, config) - }, - Requires: []*analysis.Analyzer{ - inspect.Analyzer, - }, - } -} - -func run(pass *analysis.Pass, config Config) (interface{}, error) { - isp, ok := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector) - if !ok { - return nil, errors.New("missing inspect analyser") - } - - nodeFilter := []ast.Node{ - (*ast.StructType)(nil), - } - - isp.Preorder(nodeFilter, func(n ast.Node) { - node, ok := n.(*ast.StructType) - if !ok { - return - } - - for _, field := range node.Fields.List { - analyze(pass, config, node, field) - } - }) - - return nil, nil -} - -func analyze(pass *analysis.Pass, config Config, n *ast.StructType, field *ast.Field) { - if n.Fields == nil || n.Fields.NumFields() < 1 { - // skip empty structs - return - } - - if field.Tag == nil { - // skip when no struct tag - return - } - - fieldName, err := getFieldName(field) - if err != nil { - pass.Reportf(n.Pos(), "unable to get field name: %v", err) - return - } - - for key, convName := range config.Rules { - if convName == "" { - continue - } - - value, flags, ok := lookupTagValue(field.Tag, key) - if !ok { - // skip when no struct tag for the key - continue - } - - if value == "-" { - // skip when skipped :) - continue - } - - // TODO(ldez): need to be rethink. - // This is an exception because of a bug. - // https://github.com/ldez/tagliatelle/issues/8 - // For now, tagliatelle should try to remain neutral in terms of format. - if hasTagFlag(flags, "inline") { - // skip for inline children (no name to lint) - continue - } - - if value == "" { - value = fieldName - } - - converter, err := getConverter(convName) - if err != nil { - pass.Reportf(n.Pos(), "%s(%s): %v", key, convName, err) - continue - } - - expected := value - if config.UseFieldName { - expected = fieldName - } - - if value != converter(expected) { - pass.Reportf(field.Tag.Pos(), "%s(%s): got '%s' want '%s'", key, convName, value, converter(expected)) - } - } -} - -func getFieldName(field *ast.Field) (string, error) { - var name string - for _, n := range field.Names { - if n.Name != "" { - name = n.Name - } - } - - if name != "" { - return name, nil - } - - return getTypeName(field.Type) -} - -func getTypeName(exp ast.Expr) (string, error) { - switch typ := exp.(type) { - case *ast.Ident: - return typ.Name, nil - case *ast.StarExpr: - return getTypeName(typ.X) - case *ast.SelectorExpr: - return getTypeName(typ.Sel) - default: - bytes, _ := json.Marshal(exp) - return "", fmt.Errorf("unexpected error: type %T: %s", typ, string(bytes)) - } -} - -func lookupTagValue(tag *ast.BasicLit, key string) (name string, flags []string, ok bool) { - raw := strings.Trim(tag.Value, "`") - - value, ok := reflect.StructTag(raw).Lookup(key) - if !ok { - return value, nil, ok - } - - values := strings.Split(value, ",") - - if len(values) < 1 { - return "", nil, true - } - - return values[0], values[1:], true -} - -func hasTagFlag(flags []string, query string) bool { - for _, flag := range flags { - if flag == query { - return true - } - } - - return false -} - -func getConverter(c string) (func(s string) string, error) { - switch c { - case "camel": - return strcase.ToCamel, nil - case "pascal": - return strcase.ToPascal, nil - case "kebab": - return strcase.ToKebab, nil - case "snake": - return strcase.ToSnake, nil - case "goCamel": - return strcase.ToGoCamel, nil - case "goPascal": - return strcase.ToGoPascal, nil - case "goKebab": - return strcase.ToGoKebab, nil - case "goSnake": - return strcase.ToGoSnake, nil - case "header": - return toHeader, nil - case "upper": - return strings.ToUpper, nil - case "upperSnake": - return strcase.ToSNAKE, nil - case "lower": - return strings.ToLower, nil - default: - return nil, fmt.Errorf("unsupported case: %s", c) - } -} - -func toHeader(s string) string { - return strcase.ToCase(s, strcase.TitleCase, '-') -} -- cgit mrf-deployment