summaryrefslogtreecommitdiff
path: root/vendor/github.com/Masterminds/sprig/v3
diff options
context:
space:
mode:
authorLibravatar Terin Stock <terinjokes@gmail.com>2025-03-09 17:47:56 +0100
committerLibravatar Terin Stock <terinjokes@gmail.com>2025-03-10 01:59:49 +0100
commit3ac1ee16f377d31a0fb80c8dae28b6239ac4229e (patch)
treef61faa581feaaeaba2542b9f2b8234a590684413 /vendor/github.com/Masterminds/sprig/v3
parent[chore] update URLs to forked source (diff)
downloadgotosocial-3ac1ee16f377d31a0fb80c8dae28b6239ac4229e.tar.xz
[chore] remove vendor
Diffstat (limited to 'vendor/github.com/Masterminds/sprig/v3')
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/.gitignore2
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/CHANGELOG.md383
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/LICENSE.txt19
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/Makefile9
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/README.md100
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/crypto.go653
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/date.go152
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/defaults.go163
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/dict.go174
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/doc.go19
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/functions.go382
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/list.go464
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/network.go12
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/numeric.go186
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/reflect.go28
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/regex.go83
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/semver.go23
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/strings.go236
-rw-r--r--vendor/github.com/Masterminds/sprig/v3/url.go66
19 files changed, 0 insertions, 3154 deletions
diff --git a/vendor/github.com/Masterminds/sprig/v3/.gitignore b/vendor/github.com/Masterminds/sprig/v3/.gitignore
deleted file mode 100644
index 5e3002f88..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-vendor/
-/.glide
diff --git a/vendor/github.com/Masterminds/sprig/v3/CHANGELOG.md b/vendor/github.com/Masterminds/sprig/v3/CHANGELOG.md
deleted file mode 100644
index 2ce45dd4e..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/CHANGELOG.md
+++ /dev/null
@@ -1,383 +0,0 @@
-# Changelog
-
-## Release 3.2.3 (2022-11-29)
-
-### Changed
-
-- Updated docs (thanks @book987 @aJetHorn @neelayu @pellizzetti @apricote @SaigyoujiYuyuko233 @AlekSi)
-- #348: Updated huandu/xstrings which fixed a snake case bug (thanks @yxxhero)
-- #353: Updated masterminds/semver which included bug fixes
-- #354: Updated golang.org/x/crypto which included bug fixes
-
-## Release 3.2.2 (2021-02-04)
-
-This is a re-release of 3.2.1 to satisfy something with the Go module system.
-
-## Release 3.2.1 (2021-02-04)
-
-### Changed
-
-- Upgraded `Masterminds/goutils` to `v1.1.1`. see the [Security Advisory](https://github.com/Masterminds/goutils/security/advisories/GHSA-xg2h-wx96-xgxr)
-
-## Release 3.2.0 (2020-12-14)
-
-### Added
-
-- #211: Added randInt function (thanks @kochurovro)
-- #223: Added fromJson and mustFromJson functions (thanks @mholt)
-- #242: Added a bcrypt function (thanks @robbiet480)
-- #253: Added randBytes function (thanks @MikaelSmith)
-- #254: Added dig function for dicts (thanks @nyarly)
-- #257: Added regexQuoteMeta for quoting regex metadata (thanks @rheaton)
-- #261: Added filepath functions osBase, osDir, osExt, osClean, osIsAbs (thanks @zugl)
-- #268: Added and and all functions for testing conditions (thanks @phuslu)
-- #181: Added float64 arithmetic addf, add1f, subf, divf, mulf, maxf, and minf
- (thanks @andrewmostello)
-- #265: Added chunk function to split array into smaller arrays (thanks @karelbilek)
-- #270: Extend certificate functions to handle non-RSA keys + add support for
- ed25519 keys (thanks @misberner)
-
-### Changed
-
-- Removed testing and support for Go 1.12. ed25519 support requires Go 1.13 or newer
-- Using semver 3.1.1 and mergo 0.3.11
-
-### Fixed
-
-- #249: Fix htmlDateInZone example (thanks @spawnia)
-
-NOTE: The dependency github.com/imdario/mergo reverted the breaking change in
-0.3.9 via 0.3.10 release.
-
-## Release 3.1.0 (2020-04-16)
-
-NOTE: The dependency github.com/imdario/mergo made a behavior change in 0.3.9
-that impacts sprig functionality. Do not use sprig with a version newer than 0.3.8.
-
-### Added
-
-- #225: Added support for generating htpasswd hash (thanks @rustycl0ck)
-- #224: Added duration filter (thanks @frebib)
-- #205: Added `seq` function (thanks @thadc23)
-
-### Changed
-
-- #203: Unlambda functions with correct signature (thanks @muesli)
-- #236: Updated the license formatting for GitHub display purposes
-- #238: Updated package dependency versions. Note, mergo not updated to 0.3.9
- as it causes a breaking change for sprig. That issue is tracked at
- https://github.com/imdario/mergo/issues/139
-
-### Fixed
-
-- #229: Fix `seq` example in docs (thanks @kalmant)
-
-## Release 3.0.2 (2019-12-13)
-
-### Fixed
-
-- #220: Updating to semver v3.0.3 to fix issue with <= ranges
-- #218: fix typo elyptical->elliptic in ecdsa key description (thanks @laverya)
-
-## Release 3.0.1 (2019-12-08)
-
-### Fixed
-
-- #212: Updated semver fixing broken constraint checking with ^0.0
-
-## Release 3.0.0 (2019-10-02)
-
-### Added
-
-- #187: Added durationRound function (thanks @yjp20)
-- #189: Added numerous template functions that return errors rather than panic (thanks @nrvnrvn)
-- #193: Added toRawJson support (thanks @Dean-Coakley)
-- #197: Added get support to dicts (thanks @Dean-Coakley)
-
-### Changed
-
-- #186: Moving dependency management to Go modules
-- #186: Updated semver to v3. This has changes in the way ^ is handled
-- #194: Updated documentation on merging and how it copies. Added example using deepCopy
-- #196: trunc now supports negative values (thanks @Dean-Coakley)
-
-## Release 2.22.0 (2019-10-02)
-
-### Added
-
-- #173: Added getHostByName function to resolve dns names to ips (thanks @fcgravalos)
-- #195: Added deepCopy function for use with dicts
-
-### Changed
-
-- Updated merge and mergeOverwrite documentation to explain copying and how to
- use deepCopy with it
-
-## Release 2.21.0 (2019-09-18)
-
-### Added
-
-- #122: Added encryptAES/decryptAES functions (thanks @n0madic)
-- #128: Added toDecimal support (thanks @Dean-Coakley)
-- #169: Added list contcat (thanks @astorath)
-- #174: Added deepEqual function (thanks @bonifaido)
-- #170: Added url parse and join functions (thanks @astorath)
-
-### Changed
-
-- #171: Updated glide config for Google UUID to v1 and to add ranges to semver and testify
-
-### Fixed
-
-- #172: Fix semver wildcard example (thanks @piepmatz)
-- #175: Fix dateInZone doc example (thanks @s3than)
-
-## Release 2.20.0 (2019-06-18)
-
-### Added
-
-- #164: Adding function to get unix epoch for a time (@mattfarina)
-- #166: Adding tests for date_in_zone (@mattfarina)
-
-### Changed
-
-- #144: Fix function comments based on best practices from Effective Go (@CodeLingoTeam)
-- #150: Handles pointer type for time.Time in "htmlDate" (@mapreal19)
-- #161, #157, #160, #153, #158, #156, #155, #159, #152 documentation updates (@badeadan)
-
-### Fixed
-
-## Release 2.19.0 (2019-03-02)
-
-IMPORTANT: This release reverts a change from 2.18.0
-
-In the previous release (2.18), we prematurely merged a partial change to the crypto functions that led to creating two sets of crypto functions (I blame @technosophos -- since that's me). This release rolls back that change, and does what was originally intended: It alters the existing crypto functions to use secure random.
-
-We debated whether this classifies as a change worthy of major revision, but given the proximity to the last release, we have decided that treating 2.18 as a faulty release is the correct course of action. We apologize for any inconvenience.
-
-### Changed
-
-- Fix substr panic 35fb796 (Alexey igrychev)
-- Remove extra period 1eb7729 (Matthew Lorimor)
-- Make random string functions use crypto by default 6ceff26 (Matthew Lorimor)
-- README edits/fixes/suggestions 08fe136 (Lauri Apple)
-
-
-## Release 2.18.0 (2019-02-12)
-
-### Added
-
-- Added mergeOverwrite function
-- cryptographic functions that use secure random (see fe1de12)
-
-### Changed
-
-- Improve documentation of regexMatch function, resolves #139 90b89ce (Jan Tagscherer)
-- Handle has for nil list 9c10885 (Daniel Cohen)
-- Document behaviour of mergeOverwrite fe0dbe9 (Lukas Rieder)
-- doc: adds missing documentation. 4b871e6 (Fernandez Ludovic)
-- Replace outdated goutils imports 01893d2 (Matthew Lorimor)
-- Surface crypto secure random strings from goutils fe1de12 (Matthew Lorimor)
-- Handle untyped nil values as paramters to string functions 2b2ec8f (Morten Torkildsen)
-
-### Fixed
-
-- Fix dict merge issue and provide mergeOverwrite .dst .src1 to overwrite from src -> dst 4c59c12 (Lukas Rieder)
-- Fix substr var names and comments d581f80 (Dean Coakley)
-- Fix substr documentation 2737203 (Dean Coakley)
-
-## Release 2.17.1 (2019-01-03)
-
-### Fixed
-
-The 2.17.0 release did not have a version pinned for xstrings, which caused compilation failures when xstrings < 1.2 was used. This adds the correct version string to glide.yaml.
-
-## Release 2.17.0 (2019-01-03)
-
-### Added
-
-- adds alder32sum function and test 6908fc2 (marshallford)
-- Added kebabcase function ca331a1 (Ilyes512)
-
-### Changed
-
-- Update goutils to 1.1.0 4e1125d (Matt Butcher)
-
-### Fixed
-
-- Fix 'has' documentation e3f2a85 (dean-coakley)
-- docs(dict): fix typo in pick example dc424f9 (Dustin Specker)
-- fixes spelling errors... not sure how that happened 4cf188a (marshallford)
-
-## Release 2.16.0 (2018-08-13)
-
-### Added
-
-- add splitn function fccb0b0 (Helgi Þorbjörnsson)
-- Add slice func df28ca7 (gongdo)
-- Generate serial number a3bdffd (Cody Coons)
-- Extract values of dict with values function df39312 (Lawrence Jones)
-
-### Changed
-
-- Modify panic message for list.slice ae38335 (gongdo)
-- Minor improvement in code quality - Removed an unreachable piece of code at defaults.go#L26:6 - Resolve formatting issues. 5834241 (Abhishek Kashyap)
-- Remove duplicated documentation 1d97af1 (Matthew Fisher)
-- Test on go 1.11 49df809 (Helgi Þormar Þorbjörnsson)
-
-### Fixed
-
-- Fix file permissions c5f40b5 (gongdo)
-- Fix example for buildCustomCert 7779e0d (Tin Lam)
-
-## Release 2.15.0 (2018-04-02)
-
-### Added
-
-- #68 and #69: Add json helpers to docs (thanks @arunvelsriram)
-- #66: Add ternary function (thanks @binoculars)
-- #67: Allow keys function to take multiple dicts (thanks @binoculars)
-- #89: Added sha1sum to crypto function (thanks @benkeil)
-- #81: Allow customizing Root CA that used by genSignedCert (thanks @chenzhiwei)
-- #92: Add travis testing for go 1.10
-- #93: Adding appveyor config for windows testing
-
-### Changed
-
-- #90: Updating to more recent dependencies
-- #73: replace satori/go.uuid with google/uuid (thanks @petterw)
-
-### Fixed
-
-- #76: Fixed documentation typos (thanks @Thiht)
-- Fixed rounding issue on the `ago` function. Note, the removes support for Go 1.8 and older
-
-## Release 2.14.1 (2017-12-01)
-
-### Fixed
-
-- #60: Fix typo in function name documentation (thanks @neil-ca-moore)
-- #61: Removing line with {{ due to blocking github pages genertion
-- #64: Update the list functions to handle int, string, and other slices for compatibility
-
-## Release 2.14.0 (2017-10-06)
-
-This new version of Sprig adds a set of functions for generating and working with SSL certificates.
-
-- `genCA` generates an SSL Certificate Authority
-- `genSelfSignedCert` generates an SSL self-signed certificate
-- `genSignedCert` generates an SSL certificate and key based on a given CA
-
-## Release 2.13.0 (2017-09-18)
-
-This release adds new functions, including:
-
-- `regexMatch`, `regexFindAll`, `regexFind`, `regexReplaceAll`, `regexReplaceAllLiteral`, and `regexSplit` to work with regular expressions
-- `floor`, `ceil`, and `round` math functions
-- `toDate` converts a string to a date
-- `nindent` is just like `indent` but also prepends a new line
-- `ago` returns the time from `time.Now`
-
-### Added
-
-- #40: Added basic regex functionality (thanks @alanquillin)
-- #41: Added ceil floor and round functions (thanks @alanquillin)
-- #48: Added toDate function (thanks @andreynering)
-- #50: Added nindent function (thanks @binoculars)
-- #46: Added ago function (thanks @slayer)
-
-### Changed
-
-- #51: Updated godocs to include new string functions (thanks @curtisallen)
-- #49: Added ability to merge multiple dicts (thanks @binoculars)
-
-## Release 2.12.0 (2017-05-17)
-
-- `snakecase`, `camelcase`, and `shuffle` are three new string functions
-- `fail` allows you to bail out of a template render when conditions are not met
-
-## Release 2.11.0 (2017-05-02)
-
-- Added `toJson` and `toPrettyJson`
-- Added `merge`
-- Refactored documentation
-
-## Release 2.10.0 (2017-03-15)
-
-- Added `semver` and `semverCompare` for Semantic Versions
-- `list` replaces `tuple`
-- Fixed issue with `join`
-- Added `first`, `last`, `intial`, `rest`, `prepend`, `append`, `toString`, `toStrings`, `sortAlpha`, `reverse`, `coalesce`, `pluck`, `pick`, `compact`, `keys`, `omit`, `uniq`, `has`, `without`
-
-## Release 2.9.0 (2017-02-23)
-
-- Added `splitList` to split a list
-- Added crypto functions of `genPrivateKey` and `derivePassword`
-
-## Release 2.8.0 (2016-12-21)
-
-- Added access to several path functions (`base`, `dir`, `clean`, `ext`, and `abs`)
-- Added functions for _mutating_ dictionaries (`set`, `unset`, `hasKey`)
-
-## Release 2.7.0 (2016-12-01)
-
-- Added `sha256sum` to generate a hash of an input
-- Added functions to convert a numeric or string to `int`, `int64`, `float64`
-
-## Release 2.6.0 (2016-10-03)
-
-- Added a `uuidv4` template function for generating UUIDs inside of a template.
-
-## Release 2.5.0 (2016-08-19)
-
-- New `trimSuffix`, `trimPrefix`, `hasSuffix`, and `hasPrefix` functions
-- New aliases have been added for a few functions that didn't follow the naming conventions (`trimAll` and `abbrevBoth`)
-- `trimall` and `abbrevboth` (notice the case) are deprecated and will be removed in 3.0.0
-
-## Release 2.4.0 (2016-08-16)
-
-- Adds two functions: `until` and `untilStep`
-
-## Release 2.3.0 (2016-06-21)
-
-- cat: Concatenate strings with whitespace separators.
-- replace: Replace parts of a string: `replace " " "-" "Me First"` renders "Me-First"
-- plural: Format plurals: `len "foo" | plural "one foo" "many foos"` renders "many foos"
-- indent: Indent blocks of text in a way that is sensitive to "\n" characters.
-
-## Release 2.2.0 (2016-04-21)
-
-- Added a `genPrivateKey` function (Thanks @bacongobbler)
-
-## Release 2.1.0 (2016-03-30)
-
-- `default` now prints the default value when it does not receive a value down the pipeline. It is much safer now to do `{{.Foo | default "bar"}}`.
-- Added accessors for "hermetic" functions. These return only functions that, when given the same input, produce the same output.
-
-## Release 2.0.0 (2016-03-29)
-
-Because we switched from `int` to `int64` as the return value for all integer math functions, the library's major version number has been incremented.
-
-- `min` complements `max` (formerly `biggest`)
-- `empty` indicates that a value is the empty value for its type
-- `tuple` creates a tuple inside of a template: `{{$t := tuple "a", "b" "c"}}`
-- `dict` creates a dictionary inside of a template `{{$d := dict "key1" "val1" "key2" "val2"}}`
-- Date formatters have been added for HTML dates (as used in `date` input fields)
-- Integer math functions can convert from a number of types, including `string` (via `strconv.ParseInt`).
-
-## Release 1.2.0 (2016-02-01)
-
-- Added quote and squote
-- Added b32enc and b32dec
-- add now takes varargs
-- biggest now takes varargs
-
-## Release 1.1.0 (2015-12-29)
-
-- Added #4: Added contains function. strings.Contains, but with the arguments
- switched to simplify common pipelines. (thanks krancour)
-- Added Travis-CI testing support
-
-## Release 1.0.0 (2015-12-23)
-
-- Initial release
diff --git a/vendor/github.com/Masterminds/sprig/v3/LICENSE.txt b/vendor/github.com/Masterminds/sprig/v3/LICENSE.txt
deleted file mode 100644
index f311b1eaa..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/LICENSE.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (C) 2013-2020 Masterminds
-
-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.
diff --git a/vendor/github.com/Masterminds/sprig/v3/Makefile b/vendor/github.com/Masterminds/sprig/v3/Makefile
deleted file mode 100644
index 78d409cde..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-.PHONY: test
-test:
- @echo "==> Running tests"
- GO111MODULE=on go test -v
-
-.PHONY: test-cover
-test-cover:
- @echo "==> Running Tests with coverage"
- GO111MODULE=on go test -cover .
diff --git a/vendor/github.com/Masterminds/sprig/v3/README.md b/vendor/github.com/Masterminds/sprig/v3/README.md
deleted file mode 100644
index 3e22c60e1..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/README.md
+++ /dev/null
@@ -1,100 +0,0 @@
-# Sprig: Template functions for Go templates
-
-[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/Masterminds/sprig/v3)
-[![Go Report Card](https://goreportcard.com/badge/github.com/Masterminds/sprig)](https://goreportcard.com/report/github.com/Masterminds/sprig)
-[![Stability: Sustained](https://masterminds.github.io/stability/sustained.svg)](https://masterminds.github.io/stability/sustained.html)
-[![](https://github.com/Masterminds/sprig/workflows/Tests/badge.svg)](https://github.com/Masterminds/sprig/actions)
-
-The Go language comes with a [built-in template
-language](http://golang.org/pkg/text/template/), but not
-very many template functions. Sprig is a library that provides more than 100 commonly
-used template functions.
-
-It is inspired by the template functions found in
-[Twig](http://twig.sensiolabs.org/documentation) and in various
-JavaScript libraries, such as [underscore.js](http://underscorejs.org/).
-
-## IMPORTANT NOTES
-
-Sprig leverages [mergo](https://github.com/imdario/mergo) to handle merges. In
-its v0.3.9 release, there was a behavior change that impacts merging template
-functions in sprig. It is currently recommended to use v0.3.10 or later of that package.
-Using v0.3.9 will cause sprig tests to fail.
-
-## Package Versions
-
-There are two active major versions of the `sprig` package.
-
-* v3 is currently stable release series on the `master` branch. The Go API should
- remain compatible with v2, the current stable version. Behavior change behind
- some functions is the reason for the new major version.
-* v2 is the previous stable release series. It has been more than three years since
- the initial release of v2. You can read the documentation and see the code
- on the [release-2](https://github.com/Masterminds/sprig/tree/release-2) branch.
- Bug fixes to this major version will continue for some time.
-
-## Usage
-
-**Template developers**: Please use Sprig's [function documentation](http://masterminds.github.io/sprig/) for
-detailed instructions and code snippets for the >100 template functions available.
-
-**Go developers**: If you'd like to include Sprig as a library in your program,
-our API documentation is available [at GoDoc.org](http://godoc.org/github.com/Masterminds/sprig).
-
-For standard usage, read on.
-
-### Load the Sprig library
-
-To load the Sprig `FuncMap`:
-
-```go
-
-import (
- "github.com/Masterminds/sprig/v3"
- "html/template"
-)
-
-// This example illustrates that the FuncMap *must* be set before the
-// templates themselves are loaded.
-tpl := template.Must(
- template.New("base").Funcs(sprig.FuncMap()).ParseGlob("*.html")
-)
-
-
-```
-
-### Calling the functions inside of templates
-
-By convention, all functions are lowercase. This seems to follow the Go
-idiom for template functions (as opposed to template methods, which are
-TitleCase). For example, this:
-
-```
-{{ "hello!" | upper | repeat 5 }}
-```
-
-produces this:
-
-```
-HELLO!HELLO!HELLO!HELLO!HELLO!
-```
-
-## Principles Driving Our Function Selection
-
-We followed these principles to decide which functions to add and how to implement them:
-
-- Use template functions to build layout. The following
- types of operations are within the domain of template functions:
- - Formatting
- - Layout
- - Simple type conversions
- - Utilities that assist in handling common formatting and layout needs (e.g. arithmetic)
-- Template functions should not return errors unless there is no way to print
- a sensible value. For example, converting a string to an integer should not
- produce an error if conversion fails. Instead, it should display a default
- value.
-- Simple math is necessary for grid layouts, pagers, and so on. Complex math
- (anything other than arithmetic) should be done outside of templates.
-- Template functions only deal with the data passed into them. They never retrieve
- data from a source.
-- Finally, do not override core Go template functions.
diff --git a/vendor/github.com/Masterminds/sprig/v3/crypto.go b/vendor/github.com/Masterminds/sprig/v3/crypto.go
deleted file mode 100644
index 13a5cd559..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/crypto.go
+++ /dev/null
@@ -1,653 +0,0 @@
-package sprig
-
-import (
- "bytes"
- "crypto"
- "crypto/aes"
- "crypto/cipher"
- "crypto/dsa"
- "crypto/ecdsa"
- "crypto/ed25519"
- "crypto/elliptic"
- "crypto/hmac"
- "crypto/rand"
- "crypto/rsa"
- "crypto/sha1"
- "crypto/sha256"
- "crypto/x509"
- "crypto/x509/pkix"
- "encoding/asn1"
- "encoding/base64"
- "encoding/binary"
- "encoding/hex"
- "encoding/pem"
- "errors"
- "fmt"
- "hash/adler32"
- "io"
- "math/big"
- "net"
- "time"
-
- "strings"
-
- "github.com/google/uuid"
- bcrypt_lib "golang.org/x/crypto/bcrypt"
- "golang.org/x/crypto/scrypt"
-)
-
-func sha256sum(input string) string {
- hash := sha256.Sum256([]byte(input))
- return hex.EncodeToString(hash[:])
-}
-
-func sha1sum(input string) string {
- hash := sha1.Sum([]byte(input))
- return hex.EncodeToString(hash[:])
-}
-
-func adler32sum(input string) string {
- hash := adler32.Checksum([]byte(input))
- return fmt.Sprintf("%d", hash)
-}
-
-func bcrypt(input string) string {
- hash, err := bcrypt_lib.GenerateFromPassword([]byte(input), bcrypt_lib.DefaultCost)
- if err != nil {
- return fmt.Sprintf("failed to encrypt string with bcrypt: %s", err)
- }
-
- return string(hash)
-}
-
-func htpasswd(username string, password string) string {
- if strings.Contains(username, ":") {
- return fmt.Sprintf("invalid username: %s", username)
- }
- return fmt.Sprintf("%s:%s", username, bcrypt(password))
-}
-
-func randBytes(count int) (string, error) {
- buf := make([]byte, count)
- if _, err := rand.Read(buf); err != nil {
- return "", err
- }
- return base64.StdEncoding.EncodeToString(buf), nil
-}
-
-// uuidv4 provides a safe and secure UUID v4 implementation
-func uuidv4() string {
- return uuid.New().String()
-}
-
-var masterPasswordSeed = "com.lyndir.masterpassword"
-
-var passwordTypeTemplates = map[string][][]byte{
- "maximum": {[]byte("anoxxxxxxxxxxxxxxxxx"), []byte("axxxxxxxxxxxxxxxxxno")},
- "long": {[]byte("CvcvnoCvcvCvcv"), []byte("CvcvCvcvnoCvcv"), []byte("CvcvCvcvCvcvno"), []byte("CvccnoCvcvCvcv"), []byte("CvccCvcvnoCvcv"),
- []byte("CvccCvcvCvcvno"), []byte("CvcvnoCvccCvcv"), []byte("CvcvCvccnoCvcv"), []byte("CvcvCvccCvcvno"), []byte("CvcvnoCvcvCvcc"),
- []byte("CvcvCvcvnoCvcc"), []byte("CvcvCvcvCvccno"), []byte("CvccnoCvccCvcv"), []byte("CvccCvccnoCvcv"), []byte("CvccCvccCvcvno"),
- []byte("CvcvnoCvccCvcc"), []byte("CvcvCvccnoCvcc"), []byte("CvcvCvccCvccno"), []byte("CvccnoCvcvCvcc"), []byte("CvccCvcvnoCvcc"),
- []byte("CvccCvcvCvccno")},
- "medium": {[]byte("CvcnoCvc"), []byte("CvcCvcno")},
- "short": {[]byte("Cvcn")},
- "basic": {[]byte("aaanaaan"), []byte("aannaaan"), []byte("aaannaaa")},
- "pin": {[]byte("nnnn")},
-}
-
-var templateCharacters = map[byte]string{
- 'V': "AEIOU",
- 'C': "BCDFGHJKLMNPQRSTVWXYZ",
- 'v': "aeiou",
- 'c': "bcdfghjklmnpqrstvwxyz",
- 'A': "AEIOUBCDFGHJKLMNPQRSTVWXYZ",
- 'a': "AEIOUaeiouBCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz",
- 'n': "0123456789",
- 'o': "@&%?,=[]_:-+*$#!'^~;()/.",
- 'x': "AEIOUaeiouBCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz0123456789!@#$%^&*()",
-}
-
-func derivePassword(counter uint32, passwordType, password, user, site string) string {
- var templates = passwordTypeTemplates[passwordType]
- if templates == nil {
- return fmt.Sprintf("cannot find password template %s", passwordType)
- }
-
- var buffer bytes.Buffer
- buffer.WriteString(masterPasswordSeed)
- binary.Write(&buffer, binary.BigEndian, uint32(len(user)))
- buffer.WriteString(user)
-
- salt := buffer.Bytes()
- key, err := scrypt.Key([]byte(password), salt, 32768, 8, 2, 64)
- if err != nil {
- return fmt.Sprintf("failed to derive password: %s", err)
- }
-
- buffer.Truncate(len(masterPasswordSeed))
- binary.Write(&buffer, binary.BigEndian, uint32(len(site)))
- buffer.WriteString(site)
- binary.Write(&buffer, binary.BigEndian, counter)
-
- var hmacv = hmac.New(sha256.New, key)
- hmacv.Write(buffer.Bytes())
- var seed = hmacv.Sum(nil)
- var temp = templates[int(seed[0])%len(templates)]
-
- buffer.Truncate(0)
- for i, element := range temp {
- passChars := templateCharacters[element]
- passChar := passChars[int(seed[i+1])%len(passChars)]
- buffer.WriteByte(passChar)
- }
-
- return buffer.String()
-}
-
-func generatePrivateKey(typ string) string {
- var priv interface{}
- var err error
- switch typ {
- case "", "rsa":
- // good enough for government work
- priv, err = rsa.GenerateKey(rand.Reader, 4096)
- case "dsa":
- key := new(dsa.PrivateKey)
- // again, good enough for government work
- if err = dsa.GenerateParameters(&key.Parameters, rand.Reader, dsa.L2048N256); err != nil {
- return fmt.Sprintf("failed to generate dsa params: %s", err)
- }
- err = dsa.GenerateKey(key, rand.Reader)
- priv = key
- case "ecdsa":
- // again, good enough for government work
- priv, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
- case "ed25519":
- _, priv, err = ed25519.GenerateKey(rand.Reader)
- default:
- return "Unknown type " + typ
- }
- if err != nil {
- return fmt.Sprintf("failed to generate private key: %s", err)
- }
-
- return string(pem.EncodeToMemory(pemBlockForKey(priv)))
-}
-
-// DSAKeyFormat stores the format for DSA keys.
-// Used by pemBlockForKey
-type DSAKeyFormat struct {
- Version int
- P, Q, G, Y, X *big.Int
-}
-
-func pemBlockForKey(priv interface{}) *pem.Block {
- switch k := priv.(type) {
- case *rsa.PrivateKey:
- return &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(k)}
- case *dsa.PrivateKey:
- val := DSAKeyFormat{
- P: k.P, Q: k.Q, G: k.G,
- Y: k.Y, X: k.X,
- }
- bytes, _ := asn1.Marshal(val)
- return &pem.Block{Type: "DSA PRIVATE KEY", Bytes: bytes}
- case *ecdsa.PrivateKey:
- b, _ := x509.MarshalECPrivateKey(k)
- return &pem.Block{Type: "EC PRIVATE KEY", Bytes: b}
- default:
- // attempt PKCS#8 format for all other keys
- b, err := x509.MarshalPKCS8PrivateKey(k)
- if err != nil {
- return nil
- }
- return &pem.Block{Type: "PRIVATE KEY", Bytes: b}
- }
-}
-
-func parsePrivateKeyPEM(pemBlock string) (crypto.PrivateKey, error) {
- block, _ := pem.Decode([]byte(pemBlock))
- if block == nil {
- return nil, errors.New("no PEM data in input")
- }
-
- if block.Type == "PRIVATE KEY" {
- priv, err := x509.ParsePKCS8PrivateKey(block.Bytes)
- if err != nil {
- return nil, fmt.Errorf("decoding PEM as PKCS#8: %s", err)
- }
- return priv, nil
- } else if !strings.HasSuffix(block.Type, " PRIVATE KEY") {
- return nil, fmt.Errorf("no private key data in PEM block of type %s", block.Type)
- }
-
- switch block.Type[:len(block.Type)-12] { // strip " PRIVATE KEY"
- case "RSA":
- priv, err := x509.ParsePKCS1PrivateKey(block.Bytes)
- if err != nil {
- return nil, fmt.Errorf("parsing RSA private key from PEM: %s", err)
- }
- return priv, nil
- case "EC":
- priv, err := x509.ParseECPrivateKey(block.Bytes)
- if err != nil {
- return nil, fmt.Errorf("parsing EC private key from PEM: %s", err)
- }
- return priv, nil
- case "DSA":
- var k DSAKeyFormat
- _, err := asn1.Unmarshal(block.Bytes, &k)
- if err != nil {
- return nil, fmt.Errorf("parsing DSA private key from PEM: %s", err)
- }
- priv := &dsa.PrivateKey{
- PublicKey: dsa.PublicKey{
- Parameters: dsa.Parameters{
- P: k.P, Q: k.Q, G: k.G,
- },
- Y: k.Y,
- },
- X: k.X,
- }
- return priv, nil
- default:
- return nil, fmt.Errorf("invalid private key type %s", block.Type)
- }
-}
-
-func getPublicKey(priv crypto.PrivateKey) (crypto.PublicKey, error) {
- switch k := priv.(type) {
- case interface{ Public() crypto.PublicKey }:
- return k.Public(), nil
- case *dsa.PrivateKey:
- return &k.PublicKey, nil
- default:
- return nil, fmt.Errorf("unable to get public key for type %T", priv)
- }
-}
-
-type certificate struct {
- Cert string
- Key string
-}
-
-func buildCustomCertificate(b64cert string, b64key string) (certificate, error) {
- crt := certificate{}
-
- cert, err := base64.StdEncoding.DecodeString(b64cert)
- if err != nil {
- return crt, errors.New("unable to decode base64 certificate")
- }
-
- key, err := base64.StdEncoding.DecodeString(b64key)
- if err != nil {
- return crt, errors.New("unable to decode base64 private key")
- }
-
- decodedCert, _ := pem.Decode(cert)
- if decodedCert == nil {
- return crt, errors.New("unable to decode certificate")
- }
- _, err = x509.ParseCertificate(decodedCert.Bytes)
- if err != nil {
- return crt, fmt.Errorf(
- "error parsing certificate: decodedCert.Bytes: %s",
- err,
- )
- }
-
- _, err = parsePrivateKeyPEM(string(key))
- if err != nil {
- return crt, fmt.Errorf(
- "error parsing private key: %s",
- err,
- )
- }
-
- crt.Cert = string(cert)
- crt.Key = string(key)
-
- return crt, nil
-}
-
-func generateCertificateAuthority(
- cn string,
- daysValid int,
-) (certificate, error) {
- priv, err := rsa.GenerateKey(rand.Reader, 2048)
- if err != nil {
- return certificate{}, fmt.Errorf("error generating rsa key: %s", err)
- }
-
- return generateCertificateAuthorityWithKeyInternal(cn, daysValid, priv)
-}
-
-func generateCertificateAuthorityWithPEMKey(
- cn string,
- daysValid int,
- privPEM string,
-) (certificate, error) {
- priv, err := parsePrivateKeyPEM(privPEM)
- if err != nil {
- return certificate{}, fmt.Errorf("parsing private key: %s", err)
- }
- return generateCertificateAuthorityWithKeyInternal(cn, daysValid, priv)
-}
-
-func generateCertificateAuthorityWithKeyInternal(
- cn string,
- daysValid int,
- priv crypto.PrivateKey,
-) (certificate, error) {
- ca := certificate{}
-
- template, err := getBaseCertTemplate(cn, nil, nil, daysValid)
- if err != nil {
- return ca, err
- }
- // Override KeyUsage and IsCA
- template.KeyUsage = x509.KeyUsageKeyEncipherment |
- x509.KeyUsageDigitalSignature |
- x509.KeyUsageCertSign
- template.IsCA = true
-
- ca.Cert, ca.Key, err = getCertAndKey(template, priv, template, priv)
-
- return ca, err
-}
-
-func generateSelfSignedCertificate(
- cn string,
- ips []interface{},
- alternateDNS []interface{},
- daysValid int,
-) (certificate, error) {
- priv, err := rsa.GenerateKey(rand.Reader, 2048)
- if err != nil {
- return certificate{}, fmt.Errorf("error generating rsa key: %s", err)
- }
- return generateSelfSignedCertificateWithKeyInternal(cn, ips, alternateDNS, daysValid, priv)
-}
-
-func generateSelfSignedCertificateWithPEMKey(
- cn string,
- ips []interface{},
- alternateDNS []interface{},
- daysValid int,
- privPEM string,
-) (certificate, error) {
- priv, err := parsePrivateKeyPEM(privPEM)
- if err != nil {
- return certificate{}, fmt.Errorf("parsing private key: %s", err)
- }
- return generateSelfSignedCertificateWithKeyInternal(cn, ips, alternateDNS, daysValid, priv)
-}
-
-func generateSelfSignedCertificateWithKeyInternal(
- cn string,
- ips []interface{},
- alternateDNS []interface{},
- daysValid int,
- priv crypto.PrivateKey,
-) (certificate, error) {
- cert := certificate{}
-
- template, err := getBaseCertTemplate(cn, ips, alternateDNS, daysValid)
- if err != nil {
- return cert, err
- }
-
- cert.Cert, cert.Key, err = getCertAndKey(template, priv, template, priv)
-
- return cert, err
-}
-
-func generateSignedCertificate(
- cn string,
- ips []interface{},
- alternateDNS []interface{},
- daysValid int,
- ca certificate,
-) (certificate, error) {
- priv, err := rsa.GenerateKey(rand.Reader, 2048)
- if err != nil {
- return certificate{}, fmt.Errorf("error generating rsa key: %s", err)
- }
- return generateSignedCertificateWithKeyInternal(cn, ips, alternateDNS, daysValid, ca, priv)
-}
-
-func generateSignedCertificateWithPEMKey(
- cn string,
- ips []interface{},
- alternateDNS []interface{},
- daysValid int,
- ca certificate,
- privPEM string,
-) (certificate, error) {
- priv, err := parsePrivateKeyPEM(privPEM)
- if err != nil {
- return certificate{}, fmt.Errorf("parsing private key: %s", err)
- }
- return generateSignedCertificateWithKeyInternal(cn, ips, alternateDNS, daysValid, ca, priv)
-}
-
-func generateSignedCertificateWithKeyInternal(
- cn string,
- ips []interface{},
- alternateDNS []interface{},
- daysValid int,
- ca certificate,
- priv crypto.PrivateKey,
-) (certificate, error) {
- cert := certificate{}
-
- decodedSignerCert, _ := pem.Decode([]byte(ca.Cert))
- if decodedSignerCert == nil {
- return cert, errors.New("unable to decode certificate")
- }
- signerCert, err := x509.ParseCertificate(decodedSignerCert.Bytes)
- if err != nil {
- return cert, fmt.Errorf(
- "error parsing certificate: decodedSignerCert.Bytes: %s",
- err,
- )
- }
- signerKey, err := parsePrivateKeyPEM(ca.Key)
- if err != nil {
- return cert, fmt.Errorf(
- "error parsing private key: %s",
- err,
- )
- }
-
- template, err := getBaseCertTemplate(cn, ips, alternateDNS, daysValid)
- if err != nil {
- return cert, err
- }
-
- cert.Cert, cert.Key, err = getCertAndKey(
- template,
- priv,
- signerCert,
- signerKey,
- )
-
- return cert, err
-}
-
-func getCertAndKey(
- template *x509.Certificate,
- signeeKey crypto.PrivateKey,
- parent *x509.Certificate,
- signingKey crypto.PrivateKey,
-) (string, string, error) {
- signeePubKey, err := getPublicKey(signeeKey)
- if err != nil {
- return "", "", fmt.Errorf("error retrieving public key from signee key: %s", err)
- }
- derBytes, err := x509.CreateCertificate(
- rand.Reader,
- template,
- parent,
- signeePubKey,
- signingKey,
- )
- if err != nil {
- return "", "", fmt.Errorf("error creating certificate: %s", err)
- }
-
- certBuffer := bytes.Buffer{}
- if err := pem.Encode(
- &certBuffer,
- &pem.Block{Type: "CERTIFICATE", Bytes: derBytes},
- ); err != nil {
- return "", "", fmt.Errorf("error pem-encoding certificate: %s", err)
- }
-
- keyBuffer := bytes.Buffer{}
- if err := pem.Encode(
- &keyBuffer,
- pemBlockForKey(signeeKey),
- ); err != nil {
- return "", "", fmt.Errorf("error pem-encoding key: %s", err)
- }
-
- return certBuffer.String(), keyBuffer.String(), nil
-}
-
-func getBaseCertTemplate(
- cn string,
- ips []interface{},
- alternateDNS []interface{},
- daysValid int,
-) (*x509.Certificate, error) {
- ipAddresses, err := getNetIPs(ips)
- if err != nil {
- return nil, err
- }
- dnsNames, err := getAlternateDNSStrs(alternateDNS)
- if err != nil {
- return nil, err
- }
- serialNumberUpperBound := new(big.Int).Lsh(big.NewInt(1), 128)
- serialNumber, err := rand.Int(rand.Reader, serialNumberUpperBound)
- if err != nil {
- return nil, err
- }
- return &x509.Certificate{
- SerialNumber: serialNumber,
- Subject: pkix.Name{
- CommonName: cn,
- },
- IPAddresses: ipAddresses,
- DNSNames: dnsNames,
- NotBefore: time.Now(),
- NotAfter: time.Now().Add(time.Hour * 24 * time.Duration(daysValid)),
- KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
- ExtKeyUsage: []x509.ExtKeyUsage{
- x509.ExtKeyUsageServerAuth,
- x509.ExtKeyUsageClientAuth,
- },
- BasicConstraintsValid: true,
- }, nil
-}
-
-func getNetIPs(ips []interface{}) ([]net.IP, error) {
- if ips == nil {
- return []net.IP{}, nil
- }
- var ipStr string
- var ok bool
- var netIP net.IP
- netIPs := make([]net.IP, len(ips))
- for i, ip := range ips {
- ipStr, ok = ip.(string)
- if !ok {
- return nil, fmt.Errorf("error parsing ip: %v is not a string", ip)
- }
- netIP = net.ParseIP(ipStr)
- if netIP == nil {
- return nil, fmt.Errorf("error parsing ip: %s", ipStr)
- }
- netIPs[i] = netIP
- }
- return netIPs, nil
-}
-
-func getAlternateDNSStrs(alternateDNS []interface{}) ([]string, error) {
- if alternateDNS == nil {
- return []string{}, nil
- }
- var dnsStr string
- var ok bool
- alternateDNSStrs := make([]string, len(alternateDNS))
- for i, dns := range alternateDNS {
- dnsStr, ok = dns.(string)
- if !ok {
- return nil, fmt.Errorf(
- "error processing alternate dns name: %v is not a string",
- dns,
- )
- }
- alternateDNSStrs[i] = dnsStr
- }
- return alternateDNSStrs, nil
-}
-
-func encryptAES(password string, plaintext string) (string, error) {
- if plaintext == "" {
- return "", nil
- }
-
- key := make([]byte, 32)
- copy(key, []byte(password))
- block, err := aes.NewCipher(key)
- if err != nil {
- return "", err
- }
-
- content := []byte(plaintext)
- blockSize := block.BlockSize()
- padding := blockSize - len(content)%blockSize
- padtext := bytes.Repeat([]byte{byte(padding)}, padding)
- content = append(content, padtext...)
-
- ciphertext := make([]byte, aes.BlockSize+len(content))
-
- iv := ciphertext[:aes.BlockSize]
- if _, err := io.ReadFull(rand.Reader, iv); err != nil {
- return "", err
- }
-
- mode := cipher.NewCBCEncrypter(block, iv)
- mode.CryptBlocks(ciphertext[aes.BlockSize:], content)
-
- return base64.StdEncoding.EncodeToString(ciphertext), nil
-}
-
-func decryptAES(password string, crypt64 string) (string, error) {
- if crypt64 == "" {
- return "", nil
- }
-
- key := make([]byte, 32)
- copy(key, []byte(password))
-
- crypt, err := base64.StdEncoding.DecodeString(crypt64)
- if err != nil {
- return "", err
- }
-
- block, err := aes.NewCipher(key)
- if err != nil {
- return "", err
- }
-
- iv := crypt[:aes.BlockSize]
- crypt = crypt[aes.BlockSize:]
- decrypted := make([]byte, len(crypt))
- mode := cipher.NewCBCDecrypter(block, iv)
- mode.CryptBlocks(decrypted, crypt)
-
- return string(decrypted[:len(decrypted)-int(decrypted[len(decrypted)-1])]), nil
-}
diff --git a/vendor/github.com/Masterminds/sprig/v3/date.go b/vendor/github.com/Masterminds/sprig/v3/date.go
deleted file mode 100644
index ed022ddac..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/date.go
+++ /dev/null
@@ -1,152 +0,0 @@
-package sprig
-
-import (
- "strconv"
- "time"
-)
-
-// Given a format and a date, format the date string.
-//
-// Date can be a `time.Time` or an `int, int32, int64`.
-// In the later case, it is treated as seconds since UNIX
-// epoch.
-func date(fmt string, date interface{}) string {
- return dateInZone(fmt, date, "Local")
-}
-
-func htmlDate(date interface{}) string {
- return dateInZone("2006-01-02", date, "Local")
-}
-
-func htmlDateInZone(date interface{}, zone string) string {
- return dateInZone("2006-01-02", date, zone)
-}
-
-func dateInZone(fmt string, date interface{}, zone string) string {
- var t time.Time
- switch date := date.(type) {
- default:
- t = time.Now()
- case time.Time:
- t = date
- case *time.Time:
- t = *date
- case int64:
- t = time.Unix(date, 0)
- case int:
- t = time.Unix(int64(date), 0)
- case int32:
- t = time.Unix(int64(date), 0)
- }
-
- loc, err := time.LoadLocation(zone)
- if err != nil {
- loc, _ = time.LoadLocation("UTC")
- }
-
- return t.In(loc).Format(fmt)
-}
-
-func dateModify(fmt string, date time.Time) time.Time {
- d, err := time.ParseDuration(fmt)
- if err != nil {
- return date
- }
- return date.Add(d)
-}
-
-func mustDateModify(fmt string, date time.Time) (time.Time, error) {
- d, err := time.ParseDuration(fmt)
- if err != nil {
- return time.Time{}, err
- }
- return date.Add(d), nil
-}
-
-func dateAgo(date interface{}) string {
- var t time.Time
-
- switch date := date.(type) {
- default:
- t = time.Now()
- case time.Time:
- t = date
- case int64:
- t = time.Unix(date, 0)
- case int:
- t = time.Unix(int64(date), 0)
- }
- // Drop resolution to seconds
- duration := time.Since(t).Round(time.Second)
- return duration.String()
-}
-
-func duration(sec interface{}) string {
- var n int64
- switch value := sec.(type) {
- default:
- n = 0
- case string:
- n, _ = strconv.ParseInt(value, 10, 64)
- case int64:
- n = value
- }
- return (time.Duration(n) * time.Second).String()
-}
-
-func durationRound(duration interface{}) string {
- var d time.Duration
- switch duration := duration.(type) {
- default:
- d = 0
- case string:
- d, _ = time.ParseDuration(duration)
- case int64:
- d = time.Duration(duration)
- case time.Time:
- d = time.Since(duration)
- }
-
- u := uint64(d)
- neg := d < 0
- if neg {
- u = -u
- }
-
- var (
- year = uint64(time.Hour) * 24 * 365
- month = uint64(time.Hour) * 24 * 30
- day = uint64(time.Hour) * 24
- hour = uint64(time.Hour)
- minute = uint64(time.Minute)
- second = uint64(time.Second)
- )
- switch {
- case u > year:
- return strconv.FormatUint(u/year, 10) + "y"
- case u > month:
- return strconv.FormatUint(u/month, 10) + "mo"
- case u > day:
- return strconv.FormatUint(u/day, 10) + "d"
- case u > hour:
- return strconv.FormatUint(u/hour, 10) + "h"
- case u > minute:
- return strconv.FormatUint(u/minute, 10) + "m"
- case u > second:
- return strconv.FormatUint(u/second, 10) + "s"
- }
- return "0s"
-}
-
-func toDate(fmt, str string) time.Time {
- t, _ := time.ParseInLocation(fmt, str, time.Local)
- return t
-}
-
-func mustToDate(fmt, str string) (time.Time, error) {
- return time.ParseInLocation(fmt, str, time.Local)
-}
-
-func unixEpoch(date time.Time) string {
- return strconv.FormatInt(date.Unix(), 10)
-}
diff --git a/vendor/github.com/Masterminds/sprig/v3/defaults.go b/vendor/github.com/Masterminds/sprig/v3/defaults.go
deleted file mode 100644
index b9f979666..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/defaults.go
+++ /dev/null
@@ -1,163 +0,0 @@
-package sprig
-
-import (
- "bytes"
- "encoding/json"
- "math/rand"
- "reflect"
- "strings"
- "time"
-)
-
-func init() {
- rand.Seed(time.Now().UnixNano())
-}
-
-// dfault checks whether `given` is set, and returns default if not set.
-//
-// This returns `d` if `given` appears not to be set, and `given` otherwise.
-//
-// For numeric types 0 is unset.
-// For strings, maps, arrays, and slices, len() = 0 is considered unset.
-// For bool, false is unset.
-// Structs are never considered unset.
-//
-// For everything else, including pointers, a nil value is unset.
-func dfault(d interface{}, given ...interface{}) interface{} {
-
- if empty(given) || empty(given[0]) {
- return d
- }
- return given[0]
-}
-
-// empty returns true if the given value has the zero value for its type.
-func empty(given interface{}) bool {
- g := reflect.ValueOf(given)
- if !g.IsValid() {
- return true
- }
-
- // Basically adapted from text/template.isTrue
- switch g.Kind() {
- default:
- return g.IsNil()
- case reflect.Array, reflect.Slice, reflect.Map, reflect.String:
- return g.Len() == 0
- case reflect.Bool:
- return !g.Bool()
- case reflect.Complex64, reflect.Complex128:
- return g.Complex() == 0
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return g.Int() == 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return g.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return g.Float() == 0
- case reflect.Struct:
- return false
- }
-}
-
-// coalesce returns the first non-empty value.
-func coalesce(v ...interface{}) interface{} {
- for _, val := range v {
- if !empty(val) {
- return val
- }
- }
- return nil
-}
-
-// all returns true if empty(x) is false for all values x in the list.
-// If the list is empty, return true.
-func all(v ...interface{}) bool {
- for _, val := range v {
- if empty(val) {
- return false
- }
- }
- return true
-}
-
-// any returns true if empty(x) is false for any x in the list.
-// If the list is empty, return false.
-func any(v ...interface{}) bool {
- for _, val := range v {
- if !empty(val) {
- return true
- }
- }
- return false
-}
-
-// fromJson decodes JSON into a structured value, ignoring errors.
-func fromJson(v string) interface{} {
- output, _ := mustFromJson(v)
- return output
-}
-
-// mustFromJson decodes JSON into a structured value, returning errors.
-func mustFromJson(v string) (interface{}, error) {
- var output interface{}
- err := json.Unmarshal([]byte(v), &output)
- return output, err
-}
-
-// toJson encodes an item into a JSON string
-func toJson(v interface{}) string {
- output, _ := json.Marshal(v)
- return string(output)
-}
-
-func mustToJson(v interface{}) (string, error) {
- output, err := json.Marshal(v)
- if err != nil {
- return "", err
- }
- return string(output), nil
-}
-
-// toPrettyJson encodes an item into a pretty (indented) JSON string
-func toPrettyJson(v interface{}) string {
- output, _ := json.MarshalIndent(v, "", " ")
- return string(output)
-}
-
-func mustToPrettyJson(v interface{}) (string, error) {
- output, err := json.MarshalIndent(v, "", " ")
- if err != nil {
- return "", err
- }
- return string(output), nil
-}
-
-// toRawJson encodes an item into a JSON string with no escaping of HTML characters.
-func toRawJson(v interface{}) string {
- output, err := mustToRawJson(v)
- if err != nil {
- panic(err)
- }
- return string(output)
-}
-
-// mustToRawJson encodes an item into a JSON string with no escaping of HTML characters.
-func mustToRawJson(v interface{}) (string, error) {
- buf := new(bytes.Buffer)
- enc := json.NewEncoder(buf)
- enc.SetEscapeHTML(false)
- err := enc.Encode(&v)
- if err != nil {
- return "", err
- }
- return strings.TrimSuffix(buf.String(), "\n"), nil
-}
-
-// ternary returns the first value if the last value is true, otherwise returns the second value.
-func ternary(vt interface{}, vf interface{}, v bool) interface{} {
- if v {
- return vt
- }
-
- return vf
-}
diff --git a/vendor/github.com/Masterminds/sprig/v3/dict.go b/vendor/github.com/Masterminds/sprig/v3/dict.go
deleted file mode 100644
index ade889698..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/dict.go
+++ /dev/null
@@ -1,174 +0,0 @@
-package sprig
-
-import (
- "github.com/imdario/mergo"
- "github.com/mitchellh/copystructure"
-)
-
-func get(d map[string]interface{}, key string) interface{} {
- if val, ok := d[key]; ok {
- return val
- }
- return ""
-}
-
-func set(d map[string]interface{}, key string, value interface{}) map[string]interface{} {
- d[key] = value
- return d
-}
-
-func unset(d map[string]interface{}, key string) map[string]interface{} {
- delete(d, key)
- return d
-}
-
-func hasKey(d map[string]interface{}, key string) bool {
- _, ok := d[key]
- return ok
-}
-
-func pluck(key string, d ...map[string]interface{}) []interface{} {
- res := []interface{}{}
- for _, dict := range d {
- if val, ok := dict[key]; ok {
- res = append(res, val)
- }
- }
- return res
-}
-
-func keys(dicts ...map[string]interface{}) []string {
- k := []string{}
- for _, dict := range dicts {
- for key := range dict {
- k = append(k, key)
- }
- }
- return k
-}
-
-func pick(dict map[string]interface{}, keys ...string) map[string]interface{} {
- res := map[string]interface{}{}
- for _, k := range keys {
- if v, ok := dict[k]; ok {
- res[k] = v
- }
- }
- return res
-}
-
-func omit(dict map[string]interface{}, keys ...string) map[string]interface{} {
- res := map[string]interface{}{}
-
- omit := make(map[string]bool, len(keys))
- for _, k := range keys {
- omit[k] = true
- }
-
- for k, v := range dict {
- if _, ok := omit[k]; !ok {
- res[k] = v
- }
- }
- return res
-}
-
-func dict(v ...interface{}) map[string]interface{} {
- dict := map[string]interface{}{}
- lenv := len(v)
- for i := 0; i < lenv; i += 2 {
- key := strval(v[i])
- if i+1 >= lenv {
- dict[key] = ""
- continue
- }
- dict[key] = v[i+1]
- }
- return dict
-}
-
-func merge(dst map[string]interface{}, srcs ...map[string]interface{}) interface{} {
- for _, src := range srcs {
- if err := mergo.Merge(&dst, src); err != nil {
- // Swallow errors inside of a template.
- return ""
- }
- }
- return dst
-}
-
-func mustMerge(dst map[string]interface{}, srcs ...map[string]interface{}) (interface{}, error) {
- for _, src := range srcs {
- if err := mergo.Merge(&dst, src); err != nil {
- return nil, err
- }
- }
- return dst, nil
-}
-
-func mergeOverwrite(dst map[string]interface{}, srcs ...map[string]interface{}) interface{} {
- for _, src := range srcs {
- if err := mergo.MergeWithOverwrite(&dst, src); err != nil {
- // Swallow errors inside of a template.
- return ""
- }
- }
- return dst
-}
-
-func mustMergeOverwrite(dst map[string]interface{}, srcs ...map[string]interface{}) (interface{}, error) {
- for _, src := range srcs {
- if err := mergo.MergeWithOverwrite(&dst, src); err != nil {
- return nil, err
- }
- }
- return dst, nil
-}
-
-func values(dict map[string]interface{}) []interface{} {
- values := []interface{}{}
- for _, value := range dict {
- values = append(values, value)
- }
-
- return values
-}
-
-func deepCopy(i interface{}) interface{} {
- c, err := mustDeepCopy(i)
- if err != nil {
- panic("deepCopy error: " + err.Error())
- }
-
- return c
-}
-
-func mustDeepCopy(i interface{}) (interface{}, error) {
- return copystructure.Copy(i)
-}
-
-func dig(ps ...interface{}) (interface{}, error) {
- if len(ps) < 3 {
- panic("dig needs at least three arguments")
- }
- dict := ps[len(ps)-1].(map[string]interface{})
- def := ps[len(ps)-2]
- ks := make([]string, len(ps)-2)
- for i := 0; i < len(ks); i++ {
- ks[i] = ps[i].(string)
- }
-
- return digFromDict(dict, def, ks)
-}
-
-func digFromDict(dict map[string]interface{}, d interface{}, ks []string) (interface{}, error) {
- k, ns := ks[0], ks[1:len(ks)]
- step, has := dict[k]
- if !has {
- return d, nil
- }
- if len(ns) == 0 {
- return step, nil
- }
- return digFromDict(step.(map[string]interface{}), d, ns)
-}
diff --git a/vendor/github.com/Masterminds/sprig/v3/doc.go b/vendor/github.com/Masterminds/sprig/v3/doc.go
deleted file mode 100644
index aabb9d448..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/doc.go
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-Package sprig provides template functions for Go.
-
-This package contains a number of utility functions for working with data
-inside of Go `html/template` and `text/template` files.
-
-To add these functions, use the `template.Funcs()` method:
-
- t := templates.New("foo").Funcs(sprig.FuncMap())
-
-Note that you should add the function map before you parse any template files.
-
- In several cases, Sprig reverses the order of arguments from the way they
- appear in the standard library. This is to make it easier to pipe
- arguments into functions.
-
-See http://masterminds.github.io/sprig/ for more detailed documentation on each of the available functions.
-*/
-package sprig
diff --git a/vendor/github.com/Masterminds/sprig/v3/functions.go b/vendor/github.com/Masterminds/sprig/v3/functions.go
deleted file mode 100644
index 57fcec1d9..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/functions.go
+++ /dev/null
@@ -1,382 +0,0 @@
-package sprig
-
-import (
- "errors"
- "html/template"
- "math/rand"
- "os"
- "path"
- "path/filepath"
- "reflect"
- "strconv"
- "strings"
- ttemplate "text/template"
- "time"
-
- util "github.com/Masterminds/goutils"
- "github.com/huandu/xstrings"
- "github.com/shopspring/decimal"
-)
-
-// FuncMap produces the function map.
-//
-// Use this to pass the functions into the template engine:
-//
-// tpl := template.New("foo").Funcs(sprig.FuncMap()))
-//
-func FuncMap() template.FuncMap {
- return HtmlFuncMap()
-}
-
-// HermeticTxtFuncMap returns a 'text/template'.FuncMap with only repeatable functions.
-func HermeticTxtFuncMap() ttemplate.FuncMap {
- r := TxtFuncMap()
- for _, name := range nonhermeticFunctions {
- delete(r, name)
- }
- return r
-}
-
-// HermeticHtmlFuncMap returns an 'html/template'.Funcmap with only repeatable functions.
-func HermeticHtmlFuncMap() template.FuncMap {
- r := HtmlFuncMap()
- for _, name := range nonhermeticFunctions {
- delete(r, name)
- }
- return r
-}
-
-// TxtFuncMap returns a 'text/template'.FuncMap
-func TxtFuncMap() ttemplate.FuncMap {
- return ttemplate.FuncMap(GenericFuncMap())
-}
-
-// HtmlFuncMap returns an 'html/template'.Funcmap
-func HtmlFuncMap() template.FuncMap {
- return template.FuncMap(GenericFuncMap())
-}
-
-// GenericFuncMap returns a copy of the basic function map as a map[string]interface{}.
-func GenericFuncMap() map[string]interface{} {
- gfm := make(map[string]interface{}, len(genericMap))
- for k, v := range genericMap {
- gfm[k] = v
- }
- return gfm
-}
-
-// These functions are not guaranteed to evaluate to the same result for given input, because they
-// refer to the environment or global state.
-var nonhermeticFunctions = []string{
- // Date functions
- "date",
- "date_in_zone",
- "date_modify",
- "now",
- "htmlDate",
- "htmlDateInZone",
- "dateInZone",
- "dateModify",
-
- // Strings
- "randAlphaNum",
- "randAlpha",
- "randAscii",
- "randNumeric",
- "randBytes",
- "uuidv4",
-
- // OS
- "env",
- "expandenv",
-
- // Network
- "getHostByName",
-}
-
-var genericMap = map[string]interface{}{
- "hello": func() string { return "Hello!" },
-
- // Date functions
- "ago": dateAgo,
- "date": date,
- "date_in_zone": dateInZone,
- "date_modify": dateModify,
- "dateInZone": dateInZone,
- "dateModify": dateModify,
- "duration": duration,
- "durationRound": durationRound,
- "htmlDate": htmlDate,
- "htmlDateInZone": htmlDateInZone,
- "must_date_modify": mustDateModify,
- "mustDateModify": mustDateModify,
- "mustToDate": mustToDate,
- "now": time.Now,
- "toDate": toDate,
- "unixEpoch": unixEpoch,
-
- // Strings
- "abbrev": abbrev,
- "abbrevboth": abbrevboth,
- "trunc": trunc,
- "trim": strings.TrimSpace,
- "upper": strings.ToUpper,
- "lower": strings.ToLower,
- "title": strings.Title,
- "untitle": untitle,
- "substr": substring,
- // Switch order so that "foo" | repeat 5
- "repeat": func(count int, str string) string { return strings.Repeat(str, count) },
- // Deprecated: Use trimAll.
- "trimall": func(a, b string) string { return strings.Trim(b, a) },
- // Switch order so that "$foo" | trimall "$"
- "trimAll": func(a, b string) string { return strings.Trim(b, a) },
- "trimSuffix": func(a, b string) string { return strings.TrimSuffix(b, a) },
- "trimPrefix": func(a, b string) string { return strings.TrimPrefix(b, a) },
- "nospace": util.DeleteWhiteSpace,
- "initials": initials,
- "randAlphaNum": randAlphaNumeric,
- "randAlpha": randAlpha,
- "randAscii": randAscii,
- "randNumeric": randNumeric,
- "swapcase": util.SwapCase,
- "shuffle": xstrings.Shuffle,
- "snakecase": xstrings.ToSnakeCase,
- "camelcase": xstrings.ToCamelCase,
- "kebabcase": xstrings.ToKebabCase,
- "wrap": func(l int, s string) string { return util.Wrap(s, l) },
- "wrapWith": func(l int, sep, str string) string { return util.WrapCustom(str, l, sep, true) },
- // Switch order so that "foobar" | contains "foo"
- "contains": func(substr string, str string) bool { return strings.Contains(str, substr) },
- "hasPrefix": func(substr string, str string) bool { return strings.HasPrefix(str, substr) },
- "hasSuffix": func(substr string, str string) bool { return strings.HasSuffix(str, substr) },
- "quote": quote,
- "squote": squote,
- "cat": cat,
- "indent": indent,
- "nindent": nindent,
- "replace": replace,
- "plural": plural,
- "sha1sum": sha1sum,
- "sha256sum": sha256sum,
- "adler32sum": adler32sum,
- "toString": strval,
-
- // Wrap Atoi to stop errors.
- "atoi": func(a string) int { i, _ := strconv.Atoi(a); return i },
- "int64": toInt64,
- "int": toInt,
- "float64": toFloat64,
- "seq": seq,
- "toDecimal": toDecimal,
-
- //"gt": func(a, b int) bool {return a > b},
- //"gte": func(a, b int) bool {return a >= b},
- //"lt": func(a, b int) bool {return a < b},
- //"lte": func(a, b int) bool {return a <= b},
-
- // split "/" foo/bar returns map[int]string{0: foo, 1: bar}
- "split": split,
- "splitList": func(sep, orig string) []string { return strings.Split(orig, sep) },
- // splitn "/" foo/bar/fuu returns map[int]string{0: foo, 1: bar/fuu}
- "splitn": splitn,
- "toStrings": strslice,
-
- "until": until,
- "untilStep": untilStep,
-
- // VERY basic arithmetic.
- "add1": func(i interface{}) int64 { return toInt64(i) + 1 },
- "add": func(i ...interface{}) int64 {
- var a int64 = 0
- for _, b := range i {
- a += toInt64(b)
- }
- return a
- },
- "sub": func(a, b interface{}) int64 { return toInt64(a) - toInt64(b) },
- "div": func(a, b interface{}) int64 { return toInt64(a) / toInt64(b) },
- "mod": func(a, b interface{}) int64 { return toInt64(a) % toInt64(b) },
- "mul": func(a interface{}, v ...interface{}) int64 {
- val := toInt64(a)
- for _, b := range v {
- val = val * toInt64(b)
- }
- return val
- },
- "randInt": func(min, max int) int { return rand.Intn(max-min) + min },
- "add1f": func(i interface{}) float64 {
- return execDecimalOp(i, []interface{}{1}, func(d1, d2 decimal.Decimal) decimal.Decimal { return d1.Add(d2) })
- },
- "addf": func(i ...interface{}) float64 {
- a := interface{}(float64(0))
- return execDecimalOp(a, i, func(d1, d2 decimal.Decimal) decimal.Decimal { return d1.Add(d2) })
- },
- "subf": func(a interface{}, v ...interface{}) float64 {
- return execDecimalOp(a, v, func(d1, d2 decimal.Decimal) decimal.Decimal { return d1.Sub(d2) })
- },
- "divf": func(a interface{}, v ...interface{}) float64 {
- return execDecimalOp(a, v, func(d1, d2 decimal.Decimal) decimal.Decimal { return d1.Div(d2) })
- },
- "mulf": func(a interface{}, v ...interface{}) float64 {
- return execDecimalOp(a, v, func(d1, d2 decimal.Decimal) decimal.Decimal { return d1.Mul(d2) })
- },
- "biggest": max,
- "max": max,
- "min": min,
- "maxf": maxf,
- "minf": minf,
- "ceil": ceil,
- "floor": floor,
- "round": round,
-
- // string slices. Note that we reverse the order b/c that's better
- // for template processing.
- "join": join,
- "sortAlpha": sortAlpha,
-
- // Defaults
- "default": dfault,
- "empty": empty,
- "coalesce": coalesce,
- "all": all,
- "any": any,
- "compact": compact,
- "mustCompact": mustCompact,
- "fromJson": fromJson,
- "toJson": toJson,
- "toPrettyJson": toPrettyJson,
- "toRawJson": toRawJson,
- "mustFromJson": mustFromJson,
- "mustToJson": mustToJson,
- "mustToPrettyJson": mustToPrettyJson,
- "mustToRawJson": mustToRawJson,
- "ternary": ternary,
- "deepCopy": deepCopy,
- "mustDeepCopy": mustDeepCopy,
-
- // Reflection
- "typeOf": typeOf,
- "typeIs": typeIs,
- "typeIsLike": typeIsLike,
- "kindOf": kindOf,
- "kindIs": kindIs,
- "deepEqual": reflect.DeepEqual,
-
- // OS:
- "env": os.Getenv,
- "expandenv": os.ExpandEnv,
-
- // Network:
- "getHostByName": getHostByName,
-
- // Paths:
- "base": path.Base,
- "dir": path.Dir,
- "clean": path.Clean,
- "ext": path.Ext,
- "isAbs": path.IsAbs,
-
- // Filepaths:
- "osBase": filepath.Base,
- "osClean": filepath.Clean,
- "osDir": filepath.Dir,
- "osExt": filepath.Ext,
- "osIsAbs": filepath.IsAbs,
-
- // Encoding:
- "b64enc": base64encode,
- "b64dec": base64decode,
- "b32enc": base32encode,
- "b32dec": base32decode,
-
- // Data Structures:
- "tuple": list, // FIXME: with the addition of append/prepend these are no longer immutable.
- "list": list,
- "dict": dict,
- "get": get,
- "set": set,
- "unset": unset,
- "hasKey": hasKey,
- "pluck": pluck,
- "keys": keys,
- "pick": pick,
- "omit": omit,
- "merge": merge,
- "mergeOverwrite": mergeOverwrite,
- "mustMerge": mustMerge,
- "mustMergeOverwrite": mustMergeOverwrite,
- "values": values,
-
- "append": push, "push": push,
- "mustAppend": mustPush, "mustPush": mustPush,
- "prepend": prepend,
- "mustPrepend": mustPrepend,
- "first": first,
- "mustFirst": mustFirst,
- "rest": rest,
- "mustRest": mustRest,
- "last": last,
- "mustLast": mustLast,
- "initial": initial,
- "mustInitial": mustInitial,
- "reverse": reverse,
- "mustReverse": mustReverse,
- "uniq": uniq,
- "mustUniq": mustUniq,
- "without": without,
- "mustWithout": mustWithout,
- "has": has,
- "mustHas": mustHas,
- "slice": slice,
- "mustSlice": mustSlice,
- "concat": concat,
- "dig": dig,
- "chunk": chunk,
- "mustChunk": mustChunk,
-
- // Crypto:
- "bcrypt": bcrypt,
- "htpasswd": htpasswd,
- "genPrivateKey": generatePrivateKey,
- "derivePassword": derivePassword,
- "buildCustomCert": buildCustomCertificate,
- "genCA": generateCertificateAuthority,
- "genCAWithKey": generateCertificateAuthorityWithPEMKey,
- "genSelfSignedCert": generateSelfSignedCertificate,
- "genSelfSignedCertWithKey": generateSelfSignedCertificateWithPEMKey,
- "genSignedCert": generateSignedCertificate,
- "genSignedCertWithKey": generateSignedCertificateWithPEMKey,
- "encryptAES": encryptAES,
- "decryptAES": decryptAES,
- "randBytes": randBytes,
-
- // UUIDs:
- "uuidv4": uuidv4,
-
- // SemVer:
- "semver": semver,
- "semverCompare": semverCompare,
-
- // Flow Control:
- "fail": func(msg string) (string, error) { return "", errors.New(msg) },
-
- // Regex
- "regexMatch": regexMatch,
- "mustRegexMatch": mustRegexMatch,
- "regexFindAll": regexFindAll,
- "mustRegexFindAll": mustRegexFindAll,
- "regexFind": regexFind,
- "mustRegexFind": mustRegexFind,
- "regexReplaceAll": regexReplaceAll,
- "mustRegexReplaceAll": mustRegexReplaceAll,
- "regexReplaceAllLiteral": regexReplaceAllLiteral,
- "mustRegexReplaceAllLiteral": mustRegexReplaceAllLiteral,
- "regexSplit": regexSplit,
- "mustRegexSplit": mustRegexSplit,
- "regexQuoteMeta": regexQuoteMeta,
-
- // URLs:
- "urlParse": urlParse,
- "urlJoin": urlJoin,
-}
diff --git a/vendor/github.com/Masterminds/sprig/v3/list.go b/vendor/github.com/Masterminds/sprig/v3/list.go
deleted file mode 100644
index ca0fbb789..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/list.go
+++ /dev/null
@@ -1,464 +0,0 @@
-package sprig
-
-import (
- "fmt"
- "math"
- "reflect"
- "sort"
-)
-
-// Reflection is used in these functions so that slices and arrays of strings,
-// ints, and other types not implementing []interface{} can be worked with.
-// For example, this is useful if you need to work on the output of regexs.
-
-func list(v ...interface{}) []interface{} {
- return v
-}
-
-func push(list interface{}, v interface{}) []interface{} {
- l, err := mustPush(list, v)
- if err != nil {
- panic(err)
- }
-
- return l
-}
-
-func mustPush(list interface{}, v interface{}) ([]interface{}, error) {
- tp := reflect.TypeOf(list).Kind()
- switch tp {
- case reflect.Slice, reflect.Array:
- l2 := reflect.ValueOf(list)
-
- l := l2.Len()
- nl := make([]interface{}, l)
- for i := 0; i < l; i++ {
- nl[i] = l2.Index(i).Interface()
- }
-
- return append(nl, v), nil
-
- default:
- return nil, fmt.Errorf("Cannot push on type %s", tp)
- }
-}
-
-func prepend(list interface{}, v interface{}) []interface{} {
- l, err := mustPrepend(list, v)
- if err != nil {
- panic(err)
- }
-
- return l
-}
-
-func mustPrepend(list interface{}, v interface{}) ([]interface{}, error) {
- //return append([]interface{}{v}, list...)
-
- tp := reflect.TypeOf(list).Kind()
- switch tp {
- case reflect.Slice, reflect.Array:
- l2 := reflect.ValueOf(list)
-
- l := l2.Len()
- nl := make([]interface{}, l)
- for i := 0; i < l; i++ {
- nl[i] = l2.Index(i).Interface()
- }
-
- return append([]interface{}{v}, nl...), nil
-
- default:
- return nil, fmt.Errorf("Cannot prepend on type %s", tp)
- }
-}
-
-func chunk(size int, list interface{}) [][]interface{} {
- l, err := mustChunk(size, list)
- if err != nil {
- panic(err)
- }
-
- return l
-}
-
-func mustChunk(size int, list interface{}) ([][]interface{}, error) {
- tp := reflect.TypeOf(list).Kind()
- switch tp {
- case reflect.Slice, reflect.Array:
- l2 := reflect.ValueOf(list)
-
- l := l2.Len()
-
- cs := int(math.Floor(float64(l-1)/float64(size)) + 1)
- nl := make([][]interface{}, cs)
-
- for i := 0; i < cs; i++ {
- clen := size
- if i == cs-1 {
- clen = int(math.Floor(math.Mod(float64(l), float64(size))))
- if clen == 0 {
- clen = size
- }
- }
-
- nl[i] = make([]interface{}, clen)
-
- for j := 0; j < clen; j++ {
- ix := i*size + j
- nl[i][j] = l2.Index(ix).Interface()
- }
- }
-
- return nl, nil
-
- default:
- return nil, fmt.Errorf("Cannot chunk type %s", tp)
- }
-}
-
-func last(list interface{}) interface{} {
- l, err := mustLast(list)
- if err != nil {
- panic(err)
- }
-
- return l
-}
-
-func mustLast(list interface{}) (interface{}, error) {
- tp := reflect.TypeOf(list).Kind()
- switch tp {
- case reflect.Slice, reflect.Array:
- l2 := reflect.ValueOf(list)
-
- l := l2.Len()
- if l == 0 {
- return nil, nil
- }
-
- return l2.Index(l - 1).Interface(), nil
- default:
- return nil, fmt.Errorf("Cannot find last on type %s", tp)
- }
-}
-
-func first(list interface{}) interface{} {
- l, err := mustFirst(list)
- if err != nil {
- panic(err)
- }
-
- return l
-}
-
-func mustFirst(list interface{}) (interface{}, error) {
- tp := reflect.TypeOf(list).Kind()
- switch tp {
- case reflect.Slice, reflect.Array:
- l2 := reflect.ValueOf(list)
-
- l := l2.Len()
- if l == 0 {
- return nil, nil
- }
-
- return l2.Index(0).Interface(), nil
- default:
- return nil, fmt.Errorf("Cannot find first on type %s", tp)
- }
-}
-
-func rest(list interface{}) []interface{} {
- l, err := mustRest(list)
- if err != nil {
- panic(err)
- }
-
- return l
-}
-
-func mustRest(list interface{}) ([]interface{}, error) {
- tp := reflect.TypeOf(list).Kind()
- switch tp {
- case reflect.Slice, reflect.Array:
- l2 := reflect.ValueOf(list)
-
- l := l2.Len()
- if l == 0 {
- return nil, nil
- }
-
- nl := make([]interface{}, l-1)
- for i := 1; i < l; i++ {
- nl[i-1] = l2.Index(i).Interface()
- }
-
- return nl, nil
- default:
- return nil, fmt.Errorf("Cannot find rest on type %s", tp)
- }
-}
-
-func initial(list interface{}) []interface{} {
- l, err := mustInitial(list)
- if err != nil {
- panic(err)
- }
-
- return l
-}
-
-func mustInitial(list interface{}) ([]interface{}, error) {
- tp := reflect.TypeOf(list).Kind()
- switch tp {
- case reflect.Slice, reflect.Array:
- l2 := reflect.ValueOf(list)
-
- l := l2.Len()
- if l == 0 {
- return nil, nil
- }
-
- nl := make([]interface{}, l-1)
- for i := 0; i < l-1; i++ {
- nl[i] = l2.Index(i).Interface()
- }
-
- return nl, nil
- default:
- return nil, fmt.Errorf("Cannot find initial on type %s", tp)
- }
-}
-
-func sortAlpha(list interface{}) []string {
- k := reflect.Indirect(reflect.ValueOf(list)).Kind()
- switch k {
- case reflect.Slice, reflect.Array:
- a := strslice(list)
- s := sort.StringSlice(a)
- s.Sort()
- return s
- }
- return []string{strval(list)}
-}
-
-func reverse(v interface{}) []interface{} {
- l, err := mustReverse(v)
- if err != nil {
- panic(err)
- }
-
- return l
-}
-
-func mustReverse(v interface{}) ([]interface{}, error) {
- tp := reflect.TypeOf(v).Kind()
- switch tp {
- case reflect.Slice, reflect.Array:
- l2 := reflect.ValueOf(v)
-
- l := l2.Len()
- // We do not sort in place because the incoming array should not be altered.
- nl := make([]interface{}, l)
- for i := 0; i < l; i++ {
- nl[l-i-1] = l2.Index(i).Interface()
- }
-
- return nl, nil
- default:
- return nil, fmt.Errorf("Cannot find reverse on type %s", tp)
- }
-}
-
-func compact(list interface{}) []interface{} {
- l, err := mustCompact(list)
- if err != nil {
- panic(err)
- }
-
- return l
-}
-
-func mustCompact(list interface{}) ([]interface{}, error) {
- tp := reflect.TypeOf(list).Kind()
- switch tp {
- case reflect.Slice, reflect.Array:
- l2 := reflect.ValueOf(list)
-
- l := l2.Len()
- nl := []interface{}{}
- var item interface{}
- for i := 0; i < l; i++ {
- item = l2.Index(i).Interface()
- if !empty(item) {
- nl = append(nl, item)
- }
- }
-
- return nl, nil
- default:
- return nil, fmt.Errorf("Cannot compact on type %s", tp)
- }
-}
-
-func uniq(list interface{}) []interface{} {
- l, err := mustUniq(list)
- if err != nil {
- panic(err)
- }
-
- return l
-}
-
-func mustUniq(list interface{}) ([]interface{}, error) {
- tp := reflect.TypeOf(list).Kind()
- switch tp {
- case reflect.Slice, reflect.Array:
- l2 := reflect.ValueOf(list)
-
- l := l2.Len()
- dest := []interface{}{}
- var item interface{}
- for i := 0; i < l; i++ {
- item = l2.Index(i).Interface()
- if !inList(dest, item) {
- dest = append(dest, item)
- }
- }
-
- return dest, nil
- default:
- return nil, fmt.Errorf("Cannot find uniq on type %s", tp)
- }
-}
-
-func inList(haystack []interface{}, needle interface{}) bool {
- for _, h := range haystack {
- if reflect.DeepEqual(needle, h) {
- return true
- }
- }
- return false
-}
-
-func without(list interface{}, omit ...interface{}) []interface{} {
- l, err := mustWithout(list, omit...)
- if err != nil {
- panic(err)
- }
-
- return l
-}
-
-func mustWithout(list interface{}, omit ...interface{}) ([]interface{}, error) {
- tp := reflect.TypeOf(list).Kind()
- switch tp {
- case reflect.Slice, reflect.Array:
- l2 := reflect.ValueOf(list)
-
- l := l2.Len()
- res := []interface{}{}
- var item interface{}
- for i := 0; i < l; i++ {
- item = l2.Index(i).Interface()
- if !inList(omit, item) {
- res = append(res, item)
- }
- }
-
- return res, nil
- default:
- return nil, fmt.Errorf("Cannot find without on type %s", tp)
- }
-}
-
-func has(needle interface{}, haystack interface{}) bool {
- l, err := mustHas(needle, haystack)
- if err != nil {
- panic(err)
- }
-
- return l
-}
-
-func mustHas(needle interface{}, haystack interface{}) (bool, error) {
- if haystack == nil {
- return false, nil
- }
- tp := reflect.TypeOf(haystack).Kind()
- switch tp {
- case reflect.Slice, reflect.Array:
- l2 := reflect.ValueOf(haystack)
- var item interface{}
- l := l2.Len()
- for i := 0; i < l; i++ {
- item = l2.Index(i).Interface()
- if reflect.DeepEqual(needle, item) {
- return true, nil
- }
- }
-
- return false, nil
- default:
- return false, fmt.Errorf("Cannot find has on type %s", tp)
- }
-}
-
-// $list := [1, 2, 3, 4, 5]
-// slice $list -> list[0:5] = list[:]
-// slice $list 0 3 -> list[0:3] = list[:3]
-// slice $list 3 5 -> list[3:5]
-// slice $list 3 -> list[3:5] = list[3:]
-func slice(list interface{}, indices ...interface{}) interface{} {
- l, err := mustSlice(list, indices...)
- if err != nil {
- panic(err)
- }
-
- return l
-}
-
-func mustSlice(list interface{}, indices ...interface{}) (interface{}, error) {
- tp := reflect.TypeOf(list).Kind()
- switch tp {
- case reflect.Slice, reflect.Array:
- l2 := reflect.ValueOf(list)
-
- l := l2.Len()
- if l == 0 {
- return nil, nil
- }
-
- var start, end int
- if len(indices) > 0 {
- start = toInt(indices[0])
- }
- if len(indices) < 2 {
- end = l
- } else {
- end = toInt(indices[1])
- }
-
- return l2.Slice(start, end).Interface(), nil
- default:
- return nil, fmt.Errorf("list should be type of slice or array but %s", tp)
- }
-}
-
-func concat(lists ...interface{}) interface{} {
- var res []interface{}
- for _, list := range lists {
- tp := reflect.TypeOf(list).Kind()
- switch tp {
- case reflect.Slice, reflect.Array:
- l2 := reflect.ValueOf(list)
- for i := 0; i < l2.Len(); i++ {
- res = append(res, l2.Index(i).Interface())
- }
- default:
- panic(fmt.Sprintf("Cannot concat type %s as list", tp))
- }
- }
- return res
-}
diff --git a/vendor/github.com/Masterminds/sprig/v3/network.go b/vendor/github.com/Masterminds/sprig/v3/network.go
deleted file mode 100644
index 108d78a94..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/network.go
+++ /dev/null
@@ -1,12 +0,0 @@
-package sprig
-
-import (
- "math/rand"
- "net"
-)
-
-func getHostByName(name string) string {
- addrs, _ := net.LookupHost(name)
- //TODO: add error handing when release v3 comes out
- return addrs[rand.Intn(len(addrs))]
-}
diff --git a/vendor/github.com/Masterminds/sprig/v3/numeric.go b/vendor/github.com/Masterminds/sprig/v3/numeric.go
deleted file mode 100644
index f68e4182e..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/numeric.go
+++ /dev/null
@@ -1,186 +0,0 @@
-package sprig
-
-import (
- "fmt"
- "math"
- "strconv"
- "strings"
-
- "github.com/spf13/cast"
- "github.com/shopspring/decimal"
-)
-
-// toFloat64 converts 64-bit floats
-func toFloat64(v interface{}) float64 {
- return cast.ToFloat64(v)
-}
-
-func toInt(v interface{}) int {
- return cast.ToInt(v)
-}
-
-// toInt64 converts integer types to 64-bit integers
-func toInt64(v interface{}) int64 {
- return cast.ToInt64(v)
-}
-
-func max(a interface{}, i ...interface{}) int64 {
- aa := toInt64(a)
- for _, b := range i {
- bb := toInt64(b)
- if bb > aa {
- aa = bb
- }
- }
- return aa
-}
-
-func maxf(a interface{}, i ...interface{}) float64 {
- aa := toFloat64(a)
- for _, b := range i {
- bb := toFloat64(b)
- aa = math.Max(aa, bb)
- }
- return aa
-}
-
-func min(a interface{}, i ...interface{}) int64 {
- aa := toInt64(a)
- for _, b := range i {
- bb := toInt64(b)
- if bb < aa {
- aa = bb
- }
- }
- return aa
-}
-
-func minf(a interface{}, i ...interface{}) float64 {
- aa := toFloat64(a)
- for _, b := range i {
- bb := toFloat64(b)
- aa = math.Min(aa, bb)
- }
- return aa
-}
-
-func until(count int) []int {
- step := 1
- if count < 0 {
- step = -1
- }
- return untilStep(0, count, step)
-}
-
-func untilStep(start, stop, step int) []int {
- v := []int{}
-
- if stop < start {
- if step >= 0 {
- return v
- }
- for i := start; i > stop; i += step {
- v = append(v, i)
- }
- return v
- }
-
- if step <= 0 {
- return v
- }
- for i := start; i < stop; i += step {
- v = append(v, i)
- }
- return v
-}
-
-func floor(a interface{}) float64 {
- aa := toFloat64(a)
- return math.Floor(aa)
-}
-
-func ceil(a interface{}) float64 {
- aa := toFloat64(a)
- return math.Ceil(aa)
-}
-
-func round(a interface{}, p int, rOpt ...float64) float64 {
- roundOn := .5
- if len(rOpt) > 0 {
- roundOn = rOpt[0]
- }
- val := toFloat64(a)
- places := toFloat64(p)
-
- var round float64
- pow := math.Pow(10, places)
- digit := pow * val
- _, div := math.Modf(digit)
- if div >= roundOn {
- round = math.Ceil(digit)
- } else {
- round = math.Floor(digit)
- }
- return round / pow
-}
-
-// converts unix octal to decimal
-func toDecimal(v interface{}) int64 {
- result, err := strconv.ParseInt(fmt.Sprint(v), 8, 64)
- if err != nil {
- return 0
- }
- return result
-}
-
-func seq(params ...int) string {
- increment := 1
- switch len(params) {
- case 0:
- return ""
- case 1:
- start := 1
- end := params[0]
- if end < start {
- increment = -1
- }
- return intArrayToString(untilStep(start, end+increment, increment), " ")
- case 3:
- start := params[0]
- end := params[2]
- step := params[1]
- if end < start {
- increment = -1
- if step > 0 {
- return ""
- }
- }
- return intArrayToString(untilStep(start, end+increment, step), " ")
- case 2:
- start := params[0]
- end := params[1]
- step := 1
- if end < start {
- step = -1
- }
- return intArrayToString(untilStep(start, end+step, step), " ")
- default:
- return ""
- }
-}
-
-func intArrayToString(slice []int, delimeter string) string {
- return strings.Trim(strings.Join(strings.Fields(fmt.Sprint(slice)), delimeter), "[]")
-}
-
-// performs a float and subsequent decimal.Decimal conversion on inputs,
-// and iterates through a and b executing the mathmetical operation f
-func execDecimalOp(a interface{}, b []interface{}, f func(d1, d2 decimal.Decimal) decimal.Decimal) float64 {
- prt := decimal.NewFromFloat(toFloat64(a))
- for _, x := range b {
- dx := decimal.NewFromFloat(toFloat64(x))
- prt = f(prt, dx)
- }
- rslt, _ := prt.Float64()
- return rslt
-}
diff --git a/vendor/github.com/Masterminds/sprig/v3/reflect.go b/vendor/github.com/Masterminds/sprig/v3/reflect.go
deleted file mode 100644
index 8a65c132f..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/reflect.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package sprig
-
-import (
- "fmt"
- "reflect"
-)
-
-// typeIs returns true if the src is the type named in target.
-func typeIs(target string, src interface{}) bool {
- return target == typeOf(src)
-}
-
-func typeIsLike(target string, src interface{}) bool {
- t := typeOf(src)
- return target == t || "*"+target == t
-}
-
-func typeOf(src interface{}) string {
- return fmt.Sprintf("%T", src)
-}
-
-func kindIs(target string, src interface{}) bool {
- return target == kindOf(src)
-}
-
-func kindOf(src interface{}) string {
- return reflect.ValueOf(src).Kind().String()
-}
diff --git a/vendor/github.com/Masterminds/sprig/v3/regex.go b/vendor/github.com/Masterminds/sprig/v3/regex.go
deleted file mode 100644
index fab551018..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/regex.go
+++ /dev/null
@@ -1,83 +0,0 @@
-package sprig
-
-import (
- "regexp"
-)
-
-func regexMatch(regex string, s string) bool {
- match, _ := regexp.MatchString(regex, s)
- return match
-}
-
-func mustRegexMatch(regex string, s string) (bool, error) {
- return regexp.MatchString(regex, s)
-}
-
-func regexFindAll(regex string, s string, n int) []string {
- r := regexp.MustCompile(regex)
- return r.FindAllString(s, n)
-}
-
-func mustRegexFindAll(regex string, s string, n int) ([]string, error) {
- r, err := regexp.Compile(regex)
- if err != nil {
- return []string{}, err
- }
- return r.FindAllString(s, n), nil
-}
-
-func regexFind(regex string, s string) string {
- r := regexp.MustCompile(regex)
- return r.FindString(s)
-}
-
-func mustRegexFind(regex string, s string) (string, error) {
- r, err := regexp.Compile(regex)
- if err != nil {
- return "", err
- }
- return r.FindString(s), nil
-}
-
-func regexReplaceAll(regex string, s string, repl string) string {
- r := regexp.MustCompile(regex)
- return r.ReplaceAllString(s, repl)
-}
-
-func mustRegexReplaceAll(regex string, s string, repl string) (string, error) {
- r, err := regexp.Compile(regex)
- if err != nil {
- return "", err
- }
- return r.ReplaceAllString(s, repl), nil
-}
-
-func regexReplaceAllLiteral(regex string, s string, repl string) string {
- r := regexp.MustCompile(regex)
- return r.ReplaceAllLiteralString(s, repl)
-}
-
-func mustRegexReplaceAllLiteral(regex string, s string, repl string) (string, error) {
- r, err := regexp.Compile(regex)
- if err != nil {
- return "", err
- }
- return r.ReplaceAllLiteralString(s, repl), nil
-}
-
-func regexSplit(regex string, s string, n int) []string {
- r := regexp.MustCompile(regex)
- return r.Split(s, n)
-}
-
-func mustRegexSplit(regex string, s string, n int) ([]string, error) {
- r, err := regexp.Compile(regex)
- if err != nil {
- return []string{}, err
- }
- return r.Split(s, n), nil
-}
-
-func regexQuoteMeta(s string) string {
- return regexp.QuoteMeta(s)
-}
diff --git a/vendor/github.com/Masterminds/sprig/v3/semver.go b/vendor/github.com/Masterminds/sprig/v3/semver.go
deleted file mode 100644
index 3fbe08aa6..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/semver.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package sprig
-
-import (
- sv2 "github.com/Masterminds/semver/v3"
-)
-
-func semverCompare(constraint, version string) (bool, error) {
- c, err := sv2.NewConstraint(constraint)
- if err != nil {
- return false, err
- }
-
- v, err := sv2.NewVersion(version)
- if err != nil {
- return false, err
- }
-
- return c.Check(v), nil
-}
-
-func semver(version string) (*sv2.Version, error) {
- return sv2.NewVersion(version)
-}
diff --git a/vendor/github.com/Masterminds/sprig/v3/strings.go b/vendor/github.com/Masterminds/sprig/v3/strings.go
deleted file mode 100644
index e0ae628c8..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/strings.go
+++ /dev/null
@@ -1,236 +0,0 @@
-package sprig
-
-import (
- "encoding/base32"
- "encoding/base64"
- "fmt"
- "reflect"
- "strconv"
- "strings"
-
- util "github.com/Masterminds/goutils"
-)
-
-func base64encode(v string) string {
- return base64.StdEncoding.EncodeToString([]byte(v))
-}
-
-func base64decode(v string) string {
- data, err := base64.StdEncoding.DecodeString(v)
- if err != nil {
- return err.Error()
- }
- return string(data)
-}
-
-func base32encode(v string) string {
- return base32.StdEncoding.EncodeToString([]byte(v))
-}
-
-func base32decode(v string) string {
- data, err := base32.StdEncoding.DecodeString(v)
- if err != nil {
- return err.Error()
- }
- return string(data)
-}
-
-func abbrev(width int, s string) string {
- if width < 4 {
- return s
- }
- r, _ := util.Abbreviate(s, width)
- return r
-}
-
-func abbrevboth(left, right int, s string) string {
- if right < 4 || left > 0 && right < 7 {
- return s
- }
- r, _ := util.AbbreviateFull(s, left, right)
- return r
-}
-func initials(s string) string {
- // Wrap this just to eliminate the var args, which templates don't do well.
- return util.Initials(s)
-}
-
-func randAlphaNumeric(count int) string {
- // It is not possible, it appears, to actually generate an error here.
- r, _ := util.CryptoRandomAlphaNumeric(count)
- return r
-}
-
-func randAlpha(count int) string {
- r, _ := util.CryptoRandomAlphabetic(count)
- return r
-}
-
-func randAscii(count int) string {
- r, _ := util.CryptoRandomAscii(count)
- return r
-}
-
-func randNumeric(count int) string {
- r, _ := util.CryptoRandomNumeric(count)
- return r
-}
-
-func untitle(str string) string {
- return util.Uncapitalize(str)
-}
-
-func quote(str ...interface{}) string {
- out := make([]string, 0, len(str))
- for _, s := range str {
- if s != nil {
- out = append(out, fmt.Sprintf("%q", strval(s)))
- }
- }
- return strings.Join(out, " ")
-}
-
-func squote(str ...interface{}) string {
- out := make([]string, 0, len(str))
- for _, s := range str {
- if s != nil {
- out = append(out, fmt.Sprintf("'%v'", s))
- }
- }
- return strings.Join(out, " ")
-}
-
-func cat(v ...interface{}) string {
- v = removeNilElements(v)
- r := strings.TrimSpace(strings.Repeat("%v ", len(v)))
- return fmt.Sprintf(r, v...)
-}
-
-func indent(spaces int, v string) string {
- pad := strings.Repeat(" ", spaces)
- return pad + strings.Replace(v, "\n", "\n"+pad, -1)
-}
-
-func nindent(spaces int, v string) string {
- return "\n" + indent(spaces, v)
-}
-
-func replace(old, new, src string) string {
- return strings.Replace(src, old, new, -1)
-}
-
-func plural(one, many string, count int) string {
- if count == 1 {
- return one
- }
- return many
-}
-
-func strslice(v interface{}) []string {
- switch v := v.(type) {
- case []string:
- return v
- case []interface{}:
- b := make([]string, 0, len(v))
- for _, s := range v {
- if s != nil {
- b = append(b, strval(s))
- }
- }
- return b
- default:
- val := reflect.ValueOf(v)
- switch val.Kind() {
- case reflect.Array, reflect.Slice:
- l := val.Len()
- b := make([]string, 0, l)
- for i := 0; i < l; i++ {
- value := val.Index(i).Interface()
- if value != nil {
- b = append(b, strval(value))
- }
- }
- return b
- default:
- if v == nil {
- return []string{}
- }
-
- return []string{strval(v)}
- }
- }
-}
-
-func removeNilElements(v []interface{}) []interface{} {
- newSlice := make([]interface{}, 0, len(v))
- for _, i := range v {
- if i != nil {
- newSlice = append(newSlice, i)
- }
- }
- return newSlice
-}
-
-func strval(v interface{}) string {
- switch v := v.(type) {
- case string:
- return v
- case []byte:
- return string(v)
- case error:
- return v.Error()
- case fmt.Stringer:
- return v.String()
- default:
- return fmt.Sprintf("%v", v)
- }
-}
-
-func trunc(c int, s string) string {
- if c < 0 && len(s)+c > 0 {
- return s[len(s)+c:]
- }
- if c >= 0 && len(s) > c {
- return s[:c]
- }
- return s
-}
-
-func join(sep string, v interface{}) string {
- return strings.Join(strslice(v), sep)
-}
-
-func split(sep, orig string) map[string]string {
- parts := strings.Split(orig, sep)
- res := make(map[string]string, len(parts))
- for i, v := range parts {
- res["_"+strconv.Itoa(i)] = v
- }
- return res
-}
-
-func splitn(sep string, n int, orig string) map[string]string {
- parts := strings.SplitN(orig, sep, n)
- res := make(map[string]string, len(parts))
- for i, v := range parts {
- res["_"+strconv.Itoa(i)] = v
- }
- return res
-}
-
-// substring creates a substring of the given string.
-//
-// If start is < 0, this calls string[:end].
-//
-// If start is >= 0 and end < 0 or end bigger than s length, this calls string[start:]
-//
-// Otherwise, this calls string[start, end].
-func substring(start, end int, s string) string {
- if start < 0 {
- return s[:end]
- }
- if end < 0 || end > len(s) {
- return s[start:]
- }
- return s[start:end]
-}
diff --git a/vendor/github.com/Masterminds/sprig/v3/url.go b/vendor/github.com/Masterminds/sprig/v3/url.go
deleted file mode 100644
index b8e120e19..000000000
--- a/vendor/github.com/Masterminds/sprig/v3/url.go
+++ /dev/null
@@ -1,66 +0,0 @@
-package sprig
-
-import (
- "fmt"
- "net/url"
- "reflect"
-)
-
-func dictGetOrEmpty(dict map[string]interface{}, key string) string {
- value, ok := dict[key]
- if !ok {
- return ""
- }
- tp := reflect.TypeOf(value).Kind()
- if tp != reflect.String {
- panic(fmt.Sprintf("unable to parse %s key, must be of type string, but %s found", key, tp.String()))
- }
- return reflect.ValueOf(value).String()
-}
-
-// parses given URL to return dict object
-func urlParse(v string) map[string]interface{} {
- dict := map[string]interface{}{}
- parsedURL, err := url.Parse(v)
- if err != nil {
- panic(fmt.Sprintf("unable to parse url: %s", err))
- }
- dict["scheme"] = parsedURL.Scheme
- dict["host"] = parsedURL.Host
- dict["hostname"] = parsedURL.Hostname()
- dict["path"] = parsedURL.Path
- dict["query"] = parsedURL.RawQuery
- dict["opaque"] = parsedURL.Opaque
- dict["fragment"] = parsedURL.Fragment
- if parsedURL.User != nil {
- dict["userinfo"] = parsedURL.User.String()
- } else {
- dict["userinfo"] = ""
- }
-
- return dict
-}
-
-// join given dict to URL string
-func urlJoin(d map[string]interface{}) string {
- resURL := url.URL{
- Scheme: dictGetOrEmpty(d, "scheme"),
- Host: dictGetOrEmpty(d, "host"),
- Path: dictGetOrEmpty(d, "path"),
- RawQuery: dictGetOrEmpty(d, "query"),
- Opaque: dictGetOrEmpty(d, "opaque"),
- Fragment: dictGetOrEmpty(d, "fragment"),
- }
- userinfo := dictGetOrEmpty(d, "userinfo")
- var user *url.Userinfo
- if userinfo != "" {
- tempURL, err := url.Parse(fmt.Sprintf("proto://%s@host", userinfo))
- if err != nil {
- panic(fmt.Sprintf("unable to parse userinfo in dict: %s", err))
- }
- user = tempURL.User
- }
-
- resURL.User = user
- return resURL.String()
-}