mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-06-10 09:29:34 +00:00
CI: fix build pipeline
This commit is contained in:
parent
aa4fa9aab3
commit
53efebd1f7
6
go.mod
6
go.mod
|
@ -7,9 +7,7 @@ require (
|
|||
docker.io/go-docker v1.0.0
|
||||
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
|
||||
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5 // indirect
|
||||
github.com/bmatcuk/doublestar v1.3.4 // indirect
|
||||
github.com/bmatcuk/doublestar/v4 v4.0.2
|
||||
github.com/bradrydzewski/togo v0.0.0-20180401185031-50a0e4726e74 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
|
||||
github.com/dimfeld/httptreemux v5.0.1+incompatible
|
||||
github.com/docker/cli v0.0.0-20200303215952-eb310fca4956
|
||||
|
@ -55,9 +53,9 @@ require (
|
|||
github.com/stretchr/objx v0.2.0 // indirect
|
||||
github.com/stretchr/testify v1.5.1
|
||||
github.com/tevino/abool v0.0.0-20170917061928-9b9efcf221b5
|
||||
github.com/urfave/cli v1.22.4
|
||||
github.com/urfave/cli v1.22.5
|
||||
github.com/woodpecker-ci/expr v0.0.0-20210628233344-164b8b3d0915
|
||||
github.com/woodpecker-ci/togo v0.0.0-20180401185031-50a0e4726e74
|
||||
github.com/woodpecker-ci/togo v0.0.0-20211018210511-a36120f299b0
|
||||
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37
|
||||
golang.org/x/net v0.0.0-20210614182718-04defd469f4e
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
|
||||
|
|
14
go.sum
14
go.sum
|
@ -17,12 +17,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
|
|||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/bmatcuk/doublestar v1.3.4 h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQrS0=
|
||||
github.com/bmatcuk/doublestar v1.3.4/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE=
|
||||
github.com/bmatcuk/doublestar/v4 v4.0.2 h1:X0krlUVAVmtr2cRoTqR8aDMrDqnB36ht8wpWTiQ3jsA=
|
||||
github.com/bmatcuk/doublestar/v4 v4.0.2/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
|
||||
github.com/bradrydzewski/togo v0.0.0-20180401185031-50a0e4726e74 h1:fE72rAOk9gpizJL3mNv+Ez+3yt/GCoZWtkKEPLTZvvM=
|
||||
github.com/bradrydzewski/togo v0.0.0-20180401185031-50a0e4726e74/go.mod h1:+zgWTTgi3saXD5N9SSA+LYteMbFoIJKJ9WEPXoV0jQA=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
|
@ -167,12 +163,14 @@ github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7P
|
|||
github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450 h1:j2kD3MT1z4PXCiUllUJF9mWUESr9TWKS7iEKsQ/IipM=
|
||||
github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450/go.mod h1:skjdDftzkFALcuGzYSklqYd8gvat6F1gZJ4YPVbkZpM=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/nicksnyder/go-i18n v1.10.1/go.mod h1:e4Di5xjP9oTVrC6y3C7C0HoSYXjSbhh/dU0eUV32nB4=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
||||
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
||||
github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI=
|
||||
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
|
||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
|
@ -227,12 +225,12 @@ github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
|
|||
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
|
||||
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||
github.com/urfave/cli v1.22.4 h1:u7tSpNPPswAFymm8IehJhy4uJMlUuU/GmqSkvJ1InXA=
|
||||
github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU=
|
||||
github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/woodpecker-ci/expr v0.0.0-20210628233344-164b8b3d0915 h1:9zBOoKSR9CBeYoKQv6LFIuImg8lorCjh8XzK72bJMRg=
|
||||
github.com/woodpecker-ci/expr v0.0.0-20210628233344-164b8b3d0915/go.mod h1:PbzlZ93HrA1cf16OUP1vckAPq57gtF+ccnwZeDkmC9s=
|
||||
github.com/woodpecker-ci/togo v0.0.0-20180401185031-50a0e4726e74 h1:q/tWgA3hMWrAQqsS4yfhc0+w4RevBGr9ghem/bFFDRY=
|
||||
github.com/woodpecker-ci/togo v0.0.0-20180401185031-50a0e4726e74/go.mod h1:lykh/ei/caPO6sv4NN+pqnDTo8kEKhZcnhafN8GhGNs=
|
||||
github.com/woodpecker-ci/togo v0.0.0-20211018210511-a36120f299b0 h1:jP4WIdiQAwP72PPJpVY5gpJtH/u4g0R+2erPR8l5Fa8=
|
||||
github.com/woodpecker-ci/togo v0.0.0-20211018210511-a36120f299b0/go.mod h1:L34A0IDEjrqlTTuxfKhRsY8S1drgpLh1O7GtHAnt8Xg=
|
||||
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
|
|
32
vendor/github.com/bmatcuk/doublestar/.gitignore
generated
vendored
32
vendor/github.com/bmatcuk/doublestar/.gitignore
generated
vendored
|
@ -1,32 +0,0 @@
|
|||
# vi
|
||||
*~
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
||||
|
||||
# test directory
|
||||
test/
|
20
vendor/github.com/bmatcuk/doublestar/.travis.yml
generated
vendored
20
vendor/github.com/bmatcuk/doublestar/.travis.yml
generated
vendored
|
@ -1,20 +0,0 @@
|
|||
language: go
|
||||
|
||||
go:
|
||||
- 1.12
|
||||
- 1.13
|
||||
- 1.14
|
||||
|
||||
os:
|
||||
- linux
|
||||
- windows
|
||||
|
||||
before_install:
|
||||
- go get -t -v ./...
|
||||
|
||||
script:
|
||||
- go test -race -coverprofile=coverage.txt -covermode=atomic
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
22
vendor/github.com/bmatcuk/doublestar/LICENSE
generated
vendored
22
vendor/github.com/bmatcuk/doublestar/LICENSE
generated
vendored
|
@ -1,22 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Bob Matcuk
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
140
vendor/github.com/bmatcuk/doublestar/README.md
generated
vendored
140
vendor/github.com/bmatcuk/doublestar/README.md
generated
vendored
|
@ -1,140 +0,0 @@
|
|||
# doublestar
|
||||
|
||||
Path pattern matching and globbing supporting `doublestar` (`**`) patterns.
|
||||
|
||||
![Release](https://img.shields.io/github/release/bmatcuk/doublestar.svg?branch=master)
|
||||
[![Build Status](https://travis-ci.org/bmatcuk/doublestar.svg?branch=master)](https://travis-ci.org/bmatcuk/doublestar)
|
||||
[![codecov.io](https://img.shields.io/codecov/c/github/bmatcuk/doublestar.svg?branch=master)](https://codecov.io/github/bmatcuk/doublestar?branch=master)
|
||||
|
||||
## About
|
||||
|
||||
**doublestar** is a [golang](http://golang.org/) implementation of path pattern
|
||||
matching and globbing with support for "doublestar" (aka globstar: `**`)
|
||||
patterns.
|
||||
|
||||
doublestar patterns match files and directories recursively. For example, if
|
||||
you had the following directory structure:
|
||||
|
||||
```bash
|
||||
grandparent
|
||||
`-- parent
|
||||
|-- child1
|
||||
`-- child2
|
||||
```
|
||||
|
||||
You could find the children with patterns such as: `**/child*`,
|
||||
`grandparent/**/child?`, `**/parent/*`, or even just `**` by itself (which will
|
||||
return all files and directories recursively).
|
||||
|
||||
Bash's globstar is doublestar's inspiration and, as such, works similarly.
|
||||
Note that the doublestar must appear as a path component by itself. A pattern
|
||||
such as `/path**` is invalid and will be treated the same as `/path*`, but
|
||||
`/path*/**` should achieve the desired result. Additionally, `/path/**` will
|
||||
match all directories and files under the path directory, but `/path/**/` will
|
||||
only match directories.
|
||||
|
||||
## Installation
|
||||
|
||||
**doublestar** can be installed via `go get`:
|
||||
|
||||
```bash
|
||||
go get github.com/bmatcuk/doublestar
|
||||
```
|
||||
|
||||
To use it in your code, you must import it:
|
||||
|
||||
```go
|
||||
import "github.com/bmatcuk/doublestar"
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Match
|
||||
|
||||
```go
|
||||
func Match(pattern, name string) (bool, error)
|
||||
```
|
||||
|
||||
Match returns true if `name` matches the file name `pattern`
|
||||
([see below](#patterns)). `name` and `pattern` are split on forward slash (`/`)
|
||||
characters and may be relative or absolute.
|
||||
|
||||
Note: `Match()` is meant to be a drop-in replacement for `path.Match()`. As
|
||||
such, it always uses `/` as the path separator. If you are writing code that
|
||||
will run on systems where `/` is not the path separator (such as Windows), you
|
||||
want to use `PathMatch()` (below) instead.
|
||||
|
||||
|
||||
### PathMatch
|
||||
|
||||
```go
|
||||
func PathMatch(pattern, name string) (bool, error)
|
||||
```
|
||||
|
||||
PathMatch returns true if `name` matches the file name `pattern`
|
||||
([see below](#patterns)). The difference between Match and PathMatch is that
|
||||
PathMatch will automatically use your system's path separator to split `name`
|
||||
and `pattern`.
|
||||
|
||||
`PathMatch()` is meant to be a drop-in replacement for `filepath.Match()`.
|
||||
|
||||
### Glob
|
||||
|
||||
```go
|
||||
func Glob(pattern string) ([]string, error)
|
||||
```
|
||||
|
||||
Glob finds all files and directories in the filesystem that match `pattern`
|
||||
([see below](#patterns)). `pattern` may be relative (to the current working
|
||||
directory), or absolute.
|
||||
|
||||
`Glob()` is meant to be a drop-in replacement for `filepath.Glob()`.
|
||||
|
||||
### Patterns
|
||||
|
||||
**doublestar** supports the following special terms in the patterns:
|
||||
|
||||
Special Terms | Meaning
|
||||
------------- | -------
|
||||
`*` | matches any sequence of non-path-separators
|
||||
`**` | matches any sequence of characters, including path separators
|
||||
`?` | matches any single non-path-separator character
|
||||
`[class]` | matches any single non-path-separator character against a class of characters ([see below](#character-classes))
|
||||
`{alt1,...}` | matches a sequence of characters if one of the comma-separated alternatives matches
|
||||
|
||||
Any character with a special meaning can be escaped with a backslash (`\`).
|
||||
|
||||
#### Character Classes
|
||||
|
||||
Character classes support the following:
|
||||
|
||||
Class | Meaning
|
||||
---------- | -------
|
||||
`[abc]` | matches any single character within the set
|
||||
`[a-z]` | matches any single character in the range
|
||||
`[^class]` | matches any single character which does *not* match the class
|
||||
|
||||
### Abstracting the `os` package
|
||||
|
||||
**doublestar** by default uses the `Open`, `Stat`, and `Lstat`, functions and
|
||||
`PathSeparator` value from the standard library's `os` package. To abstract
|
||||
this, for example to be able to perform tests of Windows paths on Linux, or to
|
||||
interoperate with your own filesystem code, it includes the functions `GlobOS`
|
||||
and `PathMatchOS` which are identical to `Glob` and `PathMatch` except that they
|
||||
operate on an `OS` interface:
|
||||
|
||||
```go
|
||||
type OS interface {
|
||||
Lstat(name string) (os.FileInfo, error)
|
||||
Open(name string) (*os.File, error)
|
||||
PathSeparator() rune
|
||||
Stat(name string) (os.FileInfo, error)
|
||||
}
|
||||
```
|
||||
|
||||
`StandardOS` is a value that implements this interface by calling functions in
|
||||
the standard library's `os` package.
|
||||
|
||||
## License
|
||||
|
||||
[MIT License](LICENSE)
|
684
vendor/github.com/bmatcuk/doublestar/doublestar.go
generated
vendored
684
vendor/github.com/bmatcuk/doublestar/doublestar.go
generated
vendored
|
@ -1,684 +0,0 @@
|
|||
package doublestar
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// An OS abstracts functions in the standard library's os package.
|
||||
type OS interface {
|
||||
Lstat(name string) (os.FileInfo, error)
|
||||
Open(name string) (*os.File, error)
|
||||
PathSeparator() rune
|
||||
Stat(name string) (os.FileInfo, error)
|
||||
}
|
||||
|
||||
// StandardOS is a value that implements the OS interface by calling functions
|
||||
// in the standard libray's os package.
|
||||
var StandardOS OS = standardOS{}
|
||||
|
||||
// A standardOS implements OS by calling functions in the standard library's os
|
||||
// package.
|
||||
type standardOS struct{}
|
||||
|
||||
func (standardOS) Lstat(name string) (os.FileInfo, error) { return os.Lstat(name) }
|
||||
func (standardOS) Open(name string) (*os.File, error) { return os.Open(name) }
|
||||
func (standardOS) PathSeparator() rune { return os.PathSeparator }
|
||||
func (standardOS) Stat(name string) (os.FileInfo, error) { return os.Stat(name) }
|
||||
|
||||
// ErrBadPattern indicates a pattern was malformed.
|
||||
var ErrBadPattern = path.ErrBadPattern
|
||||
|
||||
// Split a path on the given separator, respecting escaping.
|
||||
func splitPathOnSeparator(path string, separator rune) (ret []string) {
|
||||
idx := 0
|
||||
if separator == '\\' {
|
||||
// if the separator is '\\', then we can just split...
|
||||
ret = strings.Split(path, string(separator))
|
||||
idx = len(ret)
|
||||
} else {
|
||||
// otherwise, we need to be careful of situations where the separator was escaped
|
||||
cnt := strings.Count(path, string(separator))
|
||||
if cnt == 0 {
|
||||
return []string{path}
|
||||
}
|
||||
|
||||
ret = make([]string, cnt+1)
|
||||
pathlen := len(path)
|
||||
separatorLen := utf8.RuneLen(separator)
|
||||
emptyEnd := false
|
||||
for start := 0; start < pathlen; {
|
||||
end := indexRuneWithEscaping(path[start:], separator)
|
||||
if end == -1 {
|
||||
emptyEnd = false
|
||||
end = pathlen
|
||||
} else {
|
||||
emptyEnd = true
|
||||
end += start
|
||||
}
|
||||
ret[idx] = path[start:end]
|
||||
start = end + separatorLen
|
||||
idx++
|
||||
}
|
||||
|
||||
// If the last rune is a path separator, we need to append an empty string to
|
||||
// represent the last, empty path component. By default, the strings from
|
||||
// make([]string, ...) will be empty, so we just need to icrement the count
|
||||
if emptyEnd {
|
||||
idx++
|
||||
}
|
||||
}
|
||||
|
||||
return ret[:idx]
|
||||
}
|
||||
|
||||
// Find the first index of a rune in a string,
|
||||
// ignoring any times the rune is escaped using "\".
|
||||
func indexRuneWithEscaping(s string, r rune) int {
|
||||
end := strings.IndexRune(s, r)
|
||||
if end == -1 {
|
||||
return -1
|
||||
}
|
||||
if end > 0 && s[end-1] == '\\' {
|
||||
start := end + utf8.RuneLen(r)
|
||||
end = indexRuneWithEscaping(s[start:], r)
|
||||
if end != -1 {
|
||||
end += start
|
||||
}
|
||||
}
|
||||
return end
|
||||
}
|
||||
|
||||
// Find the last index of a rune in a string,
|
||||
// ignoring any times the rune is escaped using "\".
|
||||
func lastIndexRuneWithEscaping(s string, r rune) int {
|
||||
end := strings.LastIndex(s, string(r))
|
||||
if end == -1 {
|
||||
return -1
|
||||
}
|
||||
if end > 0 && s[end-1] == '\\' {
|
||||
end = lastIndexRuneWithEscaping(s[:end-1], r)
|
||||
}
|
||||
return end
|
||||
}
|
||||
|
||||
// Find the index of the first instance of one of the unicode characters in
|
||||
// chars, ignoring any times those characters are escaped using "\".
|
||||
func indexAnyWithEscaping(s, chars string) int {
|
||||
end := strings.IndexAny(s, chars)
|
||||
if end == -1 {
|
||||
return -1
|
||||
}
|
||||
if end > 0 && s[end-1] == '\\' {
|
||||
_, adj := utf8.DecodeRuneInString(s[end:])
|
||||
start := end + adj
|
||||
end = indexAnyWithEscaping(s[start:], chars)
|
||||
if end != -1 {
|
||||
end += start
|
||||
}
|
||||
}
|
||||
return end
|
||||
}
|
||||
|
||||
// Split a set of alternatives such as {alt1,alt2,...} and returns the index of
|
||||
// the rune after the closing curly brace. Respects nested alternatives and
|
||||
// escaped runes.
|
||||
func splitAlternatives(s string) (ret []string, idx int) {
|
||||
ret = make([]string, 0, 2)
|
||||
idx = 0
|
||||
slen := len(s)
|
||||
braceCnt := 1
|
||||
esc := false
|
||||
start := 0
|
||||
for braceCnt > 0 {
|
||||
if idx >= slen {
|
||||
return nil, -1
|
||||
}
|
||||
|
||||
sRune, adj := utf8.DecodeRuneInString(s[idx:])
|
||||
if esc {
|
||||
esc = false
|
||||
} else if sRune == '\\' {
|
||||
esc = true
|
||||
} else if sRune == '{' {
|
||||
braceCnt++
|
||||
} else if sRune == '}' {
|
||||
braceCnt--
|
||||
} else if sRune == ',' && braceCnt == 1 {
|
||||
ret = append(ret, s[start:idx])
|
||||
start = idx + adj
|
||||
}
|
||||
|
||||
idx += adj
|
||||
}
|
||||
ret = append(ret, s[start:idx-1])
|
||||
return
|
||||
}
|
||||
|
||||
// Returns true if the pattern is "zero length", meaning
|
||||
// it could match zero or more characters.
|
||||
func isZeroLengthPattern(pattern string) (ret bool, err error) {
|
||||
// * can match zero
|
||||
if pattern == "" || pattern == "*" || pattern == "**" {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// an alternative with zero length can match zero, for example {,x} - the
|
||||
// first alternative has zero length
|
||||
r, adj := utf8.DecodeRuneInString(pattern)
|
||||
if r == '{' {
|
||||
options, endOptions := splitAlternatives(pattern[adj:])
|
||||
if endOptions == -1 {
|
||||
return false, ErrBadPattern
|
||||
}
|
||||
if ret, err = isZeroLengthPattern(pattern[adj+endOptions:]); !ret || err != nil {
|
||||
return
|
||||
}
|
||||
for _, o := range options {
|
||||
if ret, err = isZeroLengthPattern(o); ret || err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// Match returns true if name matches the shell file name pattern.
|
||||
// The pattern syntax is:
|
||||
//
|
||||
// pattern:
|
||||
// { term }
|
||||
// term:
|
||||
// '*' matches any sequence of non-path-separators
|
||||
// '**' matches any sequence of characters, including
|
||||
// path separators.
|
||||
// '?' matches any single non-path-separator character
|
||||
// '[' [ '^' ] { character-range } ']'
|
||||
// character class (must be non-empty)
|
||||
// '{' { term } [ ',' { term } ... ] '}'
|
||||
// c matches character c (c != '*', '?', '\\', '[')
|
||||
// '\\' c matches character c
|
||||
//
|
||||
// character-range:
|
||||
// c matches character c (c != '\\', '-', ']')
|
||||
// '\\' c matches character c
|
||||
// lo '-' hi matches character c for lo <= c <= hi
|
||||
//
|
||||
// Match requires pattern to match all of name, not just a substring.
|
||||
// The path-separator defaults to the '/' character. The only possible
|
||||
// returned error is ErrBadPattern, when pattern is malformed.
|
||||
//
|
||||
// Note: this is meant as a drop-in replacement for path.Match() which
|
||||
// always uses '/' as the path separator. If you want to support systems
|
||||
// which use a different path separator (such as Windows), what you want
|
||||
// is the PathMatch() function below.
|
||||
//
|
||||
func Match(pattern, name string) (bool, error) {
|
||||
return matchWithSeparator(pattern, name, '/')
|
||||
}
|
||||
|
||||
// PathMatch is like Match except that it uses your system's path separator.
|
||||
// For most systems, this will be '/'. However, for Windows, it would be '\\'.
|
||||
// Note that for systems where the path separator is '\\', escaping is
|
||||
// disabled.
|
||||
//
|
||||
// Note: this is meant as a drop-in replacement for filepath.Match().
|
||||
//
|
||||
func PathMatch(pattern, name string) (bool, error) {
|
||||
return PathMatchOS(StandardOS, pattern, name)
|
||||
}
|
||||
|
||||
// PathMatchOS is like PathMatch except that it uses vos's path separator.
|
||||
func PathMatchOS(vos OS, pattern, name string) (bool, error) {
|
||||
pattern = filepath.ToSlash(pattern)
|
||||
return matchWithSeparator(pattern, name, vos.PathSeparator())
|
||||
}
|
||||
|
||||
// Match returns true if name matches the shell file name pattern.
|
||||
// The pattern syntax is:
|
||||
//
|
||||
// pattern:
|
||||
// { term }
|
||||
// term:
|
||||
// '*' matches any sequence of non-path-separators
|
||||
// '**' matches any sequence of characters, including
|
||||
// path separators.
|
||||
// '?' matches any single non-path-separator character
|
||||
// '[' [ '^' ] { character-range } ']'
|
||||
// character class (must be non-empty)
|
||||
// '{' { term } [ ',' { term } ... ] '}'
|
||||
// c matches character c (c != '*', '?', '\\', '[')
|
||||
// '\\' c matches character c
|
||||
//
|
||||
// character-range:
|
||||
// c matches character c (c != '\\', '-', ']')
|
||||
// '\\' c matches character c, unless separator is '\\'
|
||||
// lo '-' hi matches character c for lo <= c <= hi
|
||||
//
|
||||
// Match requires pattern to match all of name, not just a substring.
|
||||
// The only possible returned error is ErrBadPattern, when pattern
|
||||
// is malformed.
|
||||
//
|
||||
func matchWithSeparator(pattern, name string, separator rune) (bool, error) {
|
||||
nameComponents := splitPathOnSeparator(name, separator)
|
||||
return doMatching(pattern, nameComponents)
|
||||
}
|
||||
|
||||
func doMatching(pattern string, nameComponents []string) (matched bool, err error) {
|
||||
// check for some base-cases
|
||||
patternLen, nameLen := len(pattern), len(nameComponents)
|
||||
if patternLen == 0 && nameLen == 0 {
|
||||
return true, nil
|
||||
}
|
||||
if patternLen == 0 {
|
||||
if nameLen == 1 && nameComponents[0] == "" {
|
||||
return true, nil
|
||||
} else if nameLen == 0 {
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
slashIdx := indexRuneWithEscaping(pattern, '/')
|
||||
lastComponent := slashIdx == -1
|
||||
if lastComponent {
|
||||
slashIdx = len(pattern)
|
||||
}
|
||||
if pattern[:slashIdx] == "**" {
|
||||
// if our last pattern component is a doublestar, we're done -
|
||||
// doublestar will match any remaining name components, if any.
|
||||
if lastComponent {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// otherwise, try matching remaining components
|
||||
for nameIdx := 0; nameIdx < nameLen; nameIdx++ {
|
||||
if m, _ := doMatching(pattern[slashIdx+1:], nameComponents[nameIdx:]); m {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
|
||||
var matches []string
|
||||
matches, err = matchComponent(pattern, nameComponents[0])
|
||||
if matches == nil || err != nil {
|
||||
return
|
||||
}
|
||||
if len(matches) == 0 && nameLen == 1 {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
if nameLen > 1 {
|
||||
for _, alt := range matches {
|
||||
matched, err = doMatching(alt, nameComponents[1:])
|
||||
if matched || err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// Glob returns the names of all files matching pattern or nil
|
||||
// if there is no matching file. The syntax of pattern is the same
|
||||
// as in Match. The pattern may describe hierarchical names such as
|
||||
// /usr/*/bin/ed (assuming the Separator is '/').
|
||||
//
|
||||
// Glob ignores file system errors such as I/O errors reading directories.
|
||||
// The only possible returned error is ErrBadPattern, when pattern
|
||||
// is malformed.
|
||||
//
|
||||
// Your system path separator is automatically used. This means on
|
||||
// systems where the separator is '\\' (Windows), escaping will be
|
||||
// disabled.
|
||||
//
|
||||
// Note: this is meant as a drop-in replacement for filepath.Glob().
|
||||
//
|
||||
func Glob(pattern string) (matches []string, err error) {
|
||||
return GlobOS(StandardOS, pattern)
|
||||
}
|
||||
|
||||
// GlobOS is like Glob except that it operates on vos.
|
||||
func GlobOS(vos OS, pattern string) (matches []string, err error) {
|
||||
if len(pattern) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// if the pattern starts with alternatives, we need to handle that here - the
|
||||
// alternatives may be a mix of relative and absolute
|
||||
if pattern[0] == '{' {
|
||||
options, endOptions := splitAlternatives(pattern[1:])
|
||||
if endOptions == -1 {
|
||||
return nil, ErrBadPattern
|
||||
}
|
||||
for _, o := range options {
|
||||
m, e := GlobOS(vos, o+pattern[endOptions+1:])
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
matches = append(matches, m...)
|
||||
}
|
||||
return matches, nil
|
||||
}
|
||||
|
||||
// If the pattern is relative or absolute and we're on a non-Windows machine,
|
||||
// volumeName will be an empty string. If it is absolute and we're on a
|
||||
// Windows machine, volumeName will be a drive letter ("C:") for filesystem
|
||||
// paths or \\<server>\<share> for UNC paths.
|
||||
isAbs := filepath.IsAbs(pattern) || pattern[0] == '\\' || pattern[0] == '/'
|
||||
volumeName := filepath.VolumeName(pattern)
|
||||
isWindowsUNC := strings.HasPrefix(volumeName, `\\`)
|
||||
if isWindowsUNC || isAbs {
|
||||
startIdx := len(volumeName) + 1
|
||||
return doGlob(vos, fmt.Sprintf("%s%s", volumeName, string(vos.PathSeparator())), filepath.ToSlash(pattern[startIdx:]), matches)
|
||||
}
|
||||
|
||||
// otherwise, it's a relative pattern
|
||||
return doGlob(vos, ".", filepath.ToSlash(pattern), matches)
|
||||
}
|
||||
|
||||
// Perform a glob
|
||||
func doGlob(vos OS, basedir, pattern string, matches []string) (m []string, e error) {
|
||||
m = matches
|
||||
e = nil
|
||||
|
||||
// if the pattern starts with any path components that aren't globbed (ie,
|
||||
// `path/to/glob*`), we can skip over the un-globbed components (`path/to` in
|
||||
// our example).
|
||||
globIdx := indexAnyWithEscaping(pattern, "*?[{\\")
|
||||
if globIdx > 0 {
|
||||
globIdx = lastIndexRuneWithEscaping(pattern[:globIdx], '/')
|
||||
} else if globIdx == -1 {
|
||||
globIdx = lastIndexRuneWithEscaping(pattern, '/')
|
||||
}
|
||||
if globIdx > 0 {
|
||||
basedir = filepath.Join(basedir, pattern[:globIdx])
|
||||
pattern = pattern[globIdx+1:]
|
||||
}
|
||||
|
||||
// Lstat will return an error if the file/directory doesn't exist
|
||||
fi, err := vos.Lstat(basedir)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// if the pattern is empty, we've found a match
|
||||
if len(pattern) == 0 {
|
||||
m = append(m, basedir)
|
||||
return
|
||||
}
|
||||
|
||||
// otherwise, we need to check each item in the directory...
|
||||
|
||||
// first, if basedir is a symlink, follow it...
|
||||
if (fi.Mode() & os.ModeSymlink) != 0 {
|
||||
fi, err = vos.Stat(basedir)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// confirm it's a directory...
|
||||
if !fi.IsDir() {
|
||||
return
|
||||
}
|
||||
|
||||
files, err := filesInDir(vos, basedir)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
sort.Slice(files, func(i, j int) bool { return files[i].Name() < files[j].Name() })
|
||||
|
||||
slashIdx := indexRuneWithEscaping(pattern, '/')
|
||||
lastComponent := slashIdx == -1
|
||||
if lastComponent {
|
||||
slashIdx = len(pattern)
|
||||
}
|
||||
if pattern[:slashIdx] == "**" {
|
||||
// if the current component is a doublestar, we'll try depth-first
|
||||
for _, file := range files {
|
||||
// if symlink, we may want to follow
|
||||
if (file.Mode() & os.ModeSymlink) != 0 {
|
||||
file, err = vos.Stat(filepath.Join(basedir, file.Name()))
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if file.IsDir() {
|
||||
// recurse into directories
|
||||
if lastComponent {
|
||||
m = append(m, filepath.Join(basedir, file.Name()))
|
||||
}
|
||||
m, e = doGlob(vos, filepath.Join(basedir, file.Name()), pattern, m)
|
||||
} else if lastComponent {
|
||||
// if the pattern's last component is a doublestar, we match filenames, too
|
||||
m = append(m, filepath.Join(basedir, file.Name()))
|
||||
}
|
||||
}
|
||||
if lastComponent {
|
||||
return // we're done
|
||||
}
|
||||
|
||||
pattern = pattern[slashIdx+1:]
|
||||
}
|
||||
|
||||
// check items in current directory and recurse
|
||||
var match []string
|
||||
for _, file := range files {
|
||||
match, e = matchComponent(pattern, file.Name())
|
||||
if e != nil {
|
||||
return
|
||||
}
|
||||
if match != nil {
|
||||
if len(match) == 0 {
|
||||
m = append(m, filepath.Join(basedir, file.Name()))
|
||||
} else {
|
||||
for _, alt := range match {
|
||||
m, e = doGlob(vos, filepath.Join(basedir, file.Name()), alt, m)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func filesInDir(vos OS, dirPath string) (files []os.FileInfo, e error) {
|
||||
dir, err := vos.Open(dirPath)
|
||||
if err != nil {
|
||||
return nil, nil
|
||||
}
|
||||
defer func() {
|
||||
if err := dir.Close(); e == nil {
|
||||
e = err
|
||||
}
|
||||
}()
|
||||
|
||||
files, err = dir.Readdir(-1)
|
||||
if err != nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Attempt to match a single path component with a pattern. Note that the
|
||||
// pattern may include multiple components but that the "name" is just a single
|
||||
// path component. The return value is a slice of patterns that should be
|
||||
// checked against subsequent path components or nil, indicating that the
|
||||
// pattern does not match this path. It is assumed that pattern components are
|
||||
// separated by '/'
|
||||
func matchComponent(pattern, name string) ([]string, error) {
|
||||
// check for matches one rune at a time
|
||||
patternLen, nameLen := len(pattern), len(name)
|
||||
patIdx, nameIdx := 0, 0
|
||||
for patIdx < patternLen && nameIdx < nameLen {
|
||||
patRune, patAdj := utf8.DecodeRuneInString(pattern[patIdx:])
|
||||
nameRune, nameAdj := utf8.DecodeRuneInString(name[nameIdx:])
|
||||
if patRune == '/' {
|
||||
patIdx++
|
||||
break
|
||||
} else if patRune == '\\' {
|
||||
// handle escaped runes, only if separator isn't '\\'
|
||||
patIdx += patAdj
|
||||
patRune, patAdj = utf8.DecodeRuneInString(pattern[patIdx:])
|
||||
if patRune == utf8.RuneError {
|
||||
return nil, ErrBadPattern
|
||||
} else if patRune == nameRune {
|
||||
patIdx += patAdj
|
||||
nameIdx += nameAdj
|
||||
} else {
|
||||
return nil, nil
|
||||
}
|
||||
} else if patRune == '*' {
|
||||
// handle stars - a star at the end of the pattern or before a separator
|
||||
// will always match the rest of the path component
|
||||
if patIdx += patAdj; patIdx >= patternLen {
|
||||
return []string{}, nil
|
||||
}
|
||||
if patRune, patAdj = utf8.DecodeRuneInString(pattern[patIdx:]); patRune == '/' {
|
||||
return []string{pattern[patIdx+patAdj:]}, nil
|
||||
}
|
||||
|
||||
// check if we can make any matches
|
||||
for ; nameIdx < nameLen; nameIdx += nameAdj {
|
||||
if m, e := matchComponent(pattern[patIdx:], name[nameIdx:]); m != nil || e != nil {
|
||||
return m, e
|
||||
}
|
||||
_, nameAdj = utf8.DecodeRuneInString(name[nameIdx:])
|
||||
}
|
||||
return nil, nil
|
||||
} else if patRune == '[' {
|
||||
// handle character sets
|
||||
patIdx += patAdj
|
||||
endClass := indexRuneWithEscaping(pattern[patIdx:], ']')
|
||||
if endClass == -1 {
|
||||
return nil, ErrBadPattern
|
||||
}
|
||||
endClass += patIdx
|
||||
classRunes := []rune(pattern[patIdx:endClass])
|
||||
classRunesLen := len(classRunes)
|
||||
if classRunesLen > 0 {
|
||||
classIdx := 0
|
||||
matchClass := false
|
||||
if classRunes[0] == '^' {
|
||||
classIdx++
|
||||
}
|
||||
for classIdx < classRunesLen {
|
||||
low := classRunes[classIdx]
|
||||
if low == '-' {
|
||||
return nil, ErrBadPattern
|
||||
}
|
||||
classIdx++
|
||||
if low == '\\' {
|
||||
if classIdx < classRunesLen {
|
||||
low = classRunes[classIdx]
|
||||
classIdx++
|
||||
} else {
|
||||
return nil, ErrBadPattern
|
||||
}
|
||||
}
|
||||
high := low
|
||||
if classIdx < classRunesLen && classRunes[classIdx] == '-' {
|
||||
// we have a range of runes
|
||||
if classIdx++; classIdx >= classRunesLen {
|
||||
return nil, ErrBadPattern
|
||||
}
|
||||
high = classRunes[classIdx]
|
||||
if high == '-' {
|
||||
return nil, ErrBadPattern
|
||||
}
|
||||
classIdx++
|
||||
if high == '\\' {
|
||||
if classIdx < classRunesLen {
|
||||
high = classRunes[classIdx]
|
||||
classIdx++
|
||||
} else {
|
||||
return nil, ErrBadPattern
|
||||
}
|
||||
}
|
||||
}
|
||||
if low <= nameRune && nameRune <= high {
|
||||
matchClass = true
|
||||
}
|
||||
}
|
||||
if matchClass == (classRunes[0] == '^') {
|
||||
return nil, nil
|
||||
}
|
||||
} else {
|
||||
return nil, ErrBadPattern
|
||||
}
|
||||
patIdx = endClass + 1
|
||||
nameIdx += nameAdj
|
||||
} else if patRune == '{' {
|
||||
// handle alternatives such as {alt1,alt2,...}
|
||||
patIdx += patAdj
|
||||
options, endOptions := splitAlternatives(pattern[patIdx:])
|
||||
if endOptions == -1 {
|
||||
return nil, ErrBadPattern
|
||||
}
|
||||
patIdx += endOptions
|
||||
|
||||
results := make([][]string, 0, len(options))
|
||||
totalResults := 0
|
||||
for _, o := range options {
|
||||
m, e := matchComponent(o+pattern[patIdx:], name[nameIdx:])
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
if m != nil {
|
||||
results = append(results, m)
|
||||
totalResults += len(m)
|
||||
}
|
||||
}
|
||||
if len(results) > 0 {
|
||||
lst := make([]string, 0, totalResults)
|
||||
for _, m := range results {
|
||||
lst = append(lst, m...)
|
||||
}
|
||||
return lst, nil
|
||||
}
|
||||
|
||||
return nil, nil
|
||||
} else if patRune == '?' || patRune == nameRune {
|
||||
// handle single-rune wildcard
|
||||
patIdx += patAdj
|
||||
nameIdx += nameAdj
|
||||
} else {
|
||||
return nil, nil
|
||||
}
|
||||
}
|
||||
if nameIdx >= nameLen {
|
||||
if patIdx >= patternLen {
|
||||
return []string{}, nil
|
||||
}
|
||||
|
||||
pattern = pattern[patIdx:]
|
||||
slashIdx := indexRuneWithEscaping(pattern, '/')
|
||||
testPattern := pattern
|
||||
if slashIdx >= 0 {
|
||||
testPattern = pattern[:slashIdx]
|
||||
}
|
||||
|
||||
zeroLength, err := isZeroLengthPattern(testPattern)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if zeroLength {
|
||||
if slashIdx == -1 {
|
||||
return []string{}, nil
|
||||
} else {
|
||||
return []string{pattern[slashIdx+1:]}, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil, nil
|
||||
}
|
3
vendor/github.com/bmatcuk/doublestar/go.mod
generated
vendored
3
vendor/github.com/bmatcuk/doublestar/go.mod
generated
vendored
|
@ -1,3 +0,0 @@
|
|||
module github.com/bmatcuk/doublestar
|
||||
|
||||
go 1.12
|
2
vendor/github.com/urfave/cli/app.go
generated
vendored
2
vendor/github.com/urfave/cli/app.go
generated
vendored
|
@ -263,8 +263,6 @@ func (a *App) Run(arguments []string) (err error) {
|
|||
if a.Before != nil {
|
||||
beforeErr := a.Before(context)
|
||||
if beforeErr != nil {
|
||||
_, _ = fmt.Fprintf(a.Writer, "%v\n\n", beforeErr)
|
||||
_ = ShowAppHelp(context)
|
||||
a.handleExitCoder(context, beforeErr)
|
||||
err = beforeErr
|
||||
return err
|
||||
|
|
1
vendor/github.com/urfave/cli/command.go
generated
vendored
1
vendor/github.com/urfave/cli/command.go
generated
vendored
|
@ -161,7 +161,6 @@ func (c Command) Run(ctx *Context) (err error) {
|
|||
if c.Before != nil {
|
||||
err = c.Before(context)
|
||||
if err != nil {
|
||||
_ = ShowCommandHelp(context, c.Name)
|
||||
context.App.handleExitCoder(context, err)
|
||||
return err
|
||||
}
|
||||
|
|
3
vendor/github.com/urfave/cli/context.go
generated
vendored
3
vendor/github.com/urfave/cli/context.go
generated
vendored
|
@ -324,11 +324,12 @@ func checkRequiredFlags(flags []Flag, context *Context) requiredFlagsErr {
|
|||
var flagPresent bool
|
||||
var flagName string
|
||||
for _, key := range strings.Split(f.GetName(), ",") {
|
||||
key = strings.TrimSpace(key)
|
||||
if len(key) > 1 {
|
||||
flagName = key
|
||||
}
|
||||
|
||||
if context.IsSet(strings.TrimSpace(key)) {
|
||||
if context.IsSet(key) {
|
||||
flagPresent = true
|
||||
}
|
||||
}
|
||||
|
|
4
vendor/github.com/urfave/cli/flag_int64_slice.go
generated
vendored
4
vendor/github.com/urfave/cli/flag_int64_slice.go
generated
vendored
|
@ -171,7 +171,9 @@ func lookupInt64Slice(name string, set *flag.FlagSet) []int64 {
|
|||
func removeFromInt64Slice(slice []int64, val int64) []int64 {
|
||||
for i, v := range slice {
|
||||
if v == val {
|
||||
return append(slice[:i], slice[i+1:]...)
|
||||
ret := append([]int64{}, slice[:i]...)
|
||||
ret = append(ret, slice[i+1:]...)
|
||||
return ret
|
||||
}
|
||||
}
|
||||
return slice
|
||||
|
|
4
vendor/github.com/urfave/cli/flag_int_slice.go
generated
vendored
4
vendor/github.com/urfave/cli/flag_int_slice.go
generated
vendored
|
@ -170,7 +170,9 @@ func lookupIntSlice(name string, set *flag.FlagSet) []int {
|
|||
func removeFromIntSlice(slice []int, val int) []int {
|
||||
for i, v := range slice {
|
||||
if v == val {
|
||||
return append(slice[:i], slice[i+1:]...)
|
||||
ret := append([]int{}, slice[:i]...)
|
||||
ret = append(ret, slice[i+1:]...)
|
||||
return ret
|
||||
}
|
||||
}
|
||||
return slice
|
||||
|
|
4
vendor/github.com/urfave/cli/flag_string_slice.go
generated
vendored
4
vendor/github.com/urfave/cli/flag_string_slice.go
generated
vendored
|
@ -156,7 +156,9 @@ func lookupStringSlice(name string, set *flag.FlagSet) []string {
|
|||
func removeFromStringSlice(slice []string, val string) []string {
|
||||
for i, v := range slice {
|
||||
if v == val {
|
||||
return append(slice[:i], slice[i+1:]...)
|
||||
ret := append([]string{}, slice[:i]...)
|
||||
ret = append(ret, slice[i+1:]...)
|
||||
return ret
|
||||
}
|
||||
}
|
||||
return slice
|
||||
|
|
1
vendor/github.com/woodpecker-ci/togo/.gitignore
generated
vendored
Normal file
1
vendor/github.com/woodpecker-ci/togo/.gitignore
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
togo
|
35
vendor/github.com/woodpecker-ci/togo/README.md
generated
vendored
Normal file
35
vendor/github.com/woodpecker-ci/togo/README.md
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
# `togo` - togo provides tools to convert files to go
|
||||
|
||||
```
|
||||
NAME:
|
||||
togo - togo provides tools to convert files to go
|
||||
|
||||
USAGE:
|
||||
togo [global options] command [command options] [arguments...]
|
||||
|
||||
VERSION:
|
||||
1.0.0
|
||||
|
||||
AUTHOR:
|
||||
bradrydzewski
|
||||
|
||||
COMMANDS:
|
||||
ddl embed ddl statements
|
||||
sql embed sql statements
|
||||
http generate an http filesystem
|
||||
httptest generate httptest server
|
||||
tmpl embed template files
|
||||
i18n embed i18n files
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
GLOBAL OPTIONS:
|
||||
--help, -h show help
|
||||
--version, -v print the version
|
||||
```
|
||||
|
||||
## Install
|
||||
|
||||
```shell
|
||||
go get -v github.com/woodpecker-ci/togo
|
||||
```
|
||||
|
4
vendor/github.com/woodpecker-ci/togo/action_ddl.go
generated
vendored
4
vendor/github.com/woodpecker-ci/togo/action_ddl.go
generated
vendored
|
@ -6,8 +6,8 @@ import (
|
|||
|
||||
"github.com/urfave/cli"
|
||||
|
||||
"github.com/bradrydzewski/togo/parser"
|
||||
"github.com/bradrydzewski/togo/template"
|
||||
"github.com/woodpecker-ci/togo/parser"
|
||||
"github.com/woodpecker-ci/togo/template"
|
||||
)
|
||||
|
||||
type migration struct {
|
||||
|
|
7
vendor/github.com/woodpecker-ci/togo/action_http.go
generated
vendored
7
vendor/github.com/woodpecker-ci/togo/action_http.go
generated
vendored
|
@ -7,10 +7,10 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/bmatcuk/doublestar"
|
||||
"github.com/bmatcuk/doublestar/v4"
|
||||
"github.com/urfave/cli"
|
||||
|
||||
"github.com/bradrydzewski/togo/template"
|
||||
"github.com/woodpecker-ci/togo/template"
|
||||
)
|
||||
|
||||
type (
|
||||
|
@ -68,7 +68,8 @@ func httpAction(c *cli.Context) error {
|
|||
pattern = c.String("input")
|
||||
}
|
||||
|
||||
matches, err := doublestar.Glob(pattern)
|
||||
fsys := os.DirFS("")
|
||||
matches, err := doublestar.Glob(fsys, pattern)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
8
vendor/github.com/woodpecker-ci/togo/action_httptest.go
generated
vendored
8
vendor/github.com/woodpecker-ci/togo/action_httptest.go
generated
vendored
|
@ -12,10 +12,10 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/bmatcuk/doublestar"
|
||||
"github.com/bmatcuk/doublestar/v4"
|
||||
"github.com/urfave/cli"
|
||||
|
||||
"github.com/bradrydzewski/togo/template"
|
||||
"github.com/woodpecker-ci/togo/template"
|
||||
)
|
||||
|
||||
type (
|
||||
|
@ -61,8 +61,8 @@ func httptestAction(c *cli.Context) error {
|
|||
if pattern == "" {
|
||||
pattern = c.String("input")
|
||||
}
|
||||
|
||||
matches, err := doublestar.Glob(pattern)
|
||||
fsys := os.DirFS("")
|
||||
matches, err := doublestar.Glob(fsys, pattern)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
2
vendor/github.com/woodpecker-ci/togo/action_i18n.go
generated
vendored
2
vendor/github.com/woodpecker-ci/togo/action_i18n.go
generated
vendored
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/urfave/cli"
|
||||
|
||||
"github.com/bradrydzewski/togo/template"
|
||||
"github.com/woodpecker-ci/togo/template"
|
||||
)
|
||||
|
||||
type (
|
||||
|
|
4
vendor/github.com/woodpecker-ci/togo/action_sql.go
generated
vendored
4
vendor/github.com/woodpecker-ci/togo/action_sql.go
generated
vendored
|
@ -6,8 +6,8 @@ import (
|
|||
|
||||
"github.com/urfave/cli"
|
||||
|
||||
"github.com/bradrydzewski/togo/parser"
|
||||
"github.com/bradrydzewski/togo/template"
|
||||
"github.com/woodpecker-ci/togo/parser"
|
||||
"github.com/woodpecker-ci/togo/template"
|
||||
)
|
||||
|
||||
type sqlParams struct {
|
||||
|
|
2
vendor/github.com/woodpecker-ci/togo/action_tmpl.go
generated
vendored
2
vendor/github.com/woodpecker-ci/togo/action_tmpl.go
generated
vendored
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/urfave/cli"
|
||||
|
||||
"github.com/bradrydzewski/togo/template"
|
||||
"github.com/woodpecker-ci/togo/template"
|
||||
)
|
||||
|
||||
type (
|
||||
|
|
10
vendor/github.com/woodpecker-ci/togo/go.mod
generated
vendored
Normal file
10
vendor/github.com/woodpecker-ci/togo/go.mod
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
module github.com/woodpecker-ci/togo
|
||||
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/bmatcuk/doublestar/v4 v4.0.2
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/nicksnyder/go-i18n v1.10.1
|
||||
github.com/urfave/cli v1.22.5
|
||||
)
|
25
vendor/github.com/woodpecker-ci/togo/go.sum
generated
vendored
Normal file
25
vendor/github.com/woodpecker-ci/togo/go.sum
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/bmatcuk/doublestar/v4 v4.0.2 h1:X0krlUVAVmtr2cRoTqR8aDMrDqnB36ht8wpWTiQ3jsA=
|
||||
github.com/bmatcuk/doublestar/v4 v4.0.2/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/nicksnyder/go-i18n v1.10.1 h1:isfg77E/aCD7+0lD/D00ebR2MV5vgeQ276WYyDaCRQc=
|
||||
github.com/nicksnyder/go-i18n v1.10.1/go.mod h1:e4Di5xjP9oTVrC6y3C7C0HoSYXjSbhh/dU0eUV32nB4=
|
||||
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
|
||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
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/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU=
|
||||
github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
4
vendor/github.com/woodpecker-ci/togo/main.go
generated
vendored
4
vendor/github.com/woodpecker-ci/togo/main.go
generated
vendored
|
@ -11,8 +11,8 @@ func main() {
|
|||
app := cli.NewApp()
|
||||
app.Name = "togo"
|
||||
app.Usage = "togo provides tools to convert files to go"
|
||||
app.Version = "1.0.0"
|
||||
app.Author = "bradrydzewski"
|
||||
app.Version = "dev"
|
||||
app.Author = "Woodpecker Authors"
|
||||
app.Commands = []cli.Command{
|
||||
ddlCommand,
|
||||
sqlCommand,
|
||||
|
|
13
vendor/modules.txt
vendored
13
vendor/modules.txt
vendored
|
@ -30,16 +30,9 @@ github.com/Microsoft/go-winio
|
|||
github.com/Microsoft/go-winio/pkg/guid
|
||||
# github.com/beorn7/perks v1.0.1
|
||||
github.com/beorn7/perks/quantile
|
||||
# github.com/bmatcuk/doublestar v1.3.4
|
||||
## explicit
|
||||
github.com/bmatcuk/doublestar
|
||||
# github.com/bmatcuk/doublestar/v4 v4.0.2
|
||||
## explicit
|
||||
github.com/bmatcuk/doublestar/v4
|
||||
# github.com/bradrydzewski/togo v0.0.0-20180401185031-50a0e4726e74
|
||||
## explicit
|
||||
github.com/bradrydzewski/togo/parser
|
||||
github.com/bradrydzewski/togo/template
|
||||
# github.com/cespare/xxhash/v2 v2.1.1
|
||||
github.com/cespare/xxhash/v2
|
||||
# github.com/cpuguy83/go-md2man/v2 v2.0.0
|
||||
|
@ -251,16 +244,18 @@ github.com/stretchr/testify/mock
|
|||
github.com/tevino/abool
|
||||
# github.com/ugorji/go/codec v1.1.7
|
||||
github.com/ugorji/go/codec
|
||||
# github.com/urfave/cli v1.22.4
|
||||
# github.com/urfave/cli v1.22.5
|
||||
## explicit
|
||||
github.com/urfave/cli
|
||||
# github.com/woodpecker-ci/expr v0.0.0-20210628233344-164b8b3d0915
|
||||
## explicit
|
||||
github.com/woodpecker-ci/expr
|
||||
github.com/woodpecker-ci/expr/parse
|
||||
# github.com/woodpecker-ci/togo v0.0.0-20180401185031-50a0e4726e74
|
||||
# github.com/woodpecker-ci/togo v0.0.0-20211018210511-a36120f299b0
|
||||
## explicit
|
||||
github.com/woodpecker-ci/togo
|
||||
github.com/woodpecker-ci/togo/parser
|
||||
github.com/woodpecker-ci/togo/template
|
||||
# golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37
|
||||
## explicit
|
||||
golang.org/x/crypto/acme
|
||||
|
|
Loading…
Reference in a new issue