mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Upgrade to go 1.19 and update dependencies (#3069)
* Update to go 1.19 * Update dependencies * Update cross-compile script * Add missing targets to cross-compile-all * Update cache action to remove warning
This commit is contained in:
5
vendor/github.com/golang-migrate/migrate/v4/.golangci.yml
generated
vendored
5
vendor/github.com/golang-migrate/migrate/v4/.golangci.yml
generated
vendored
@@ -10,7 +10,6 @@ linters:
|
||||
- goconst
|
||||
- gofmt
|
||||
- misspell
|
||||
- maligned
|
||||
- unparam
|
||||
- nakedret
|
||||
- prealloc
|
||||
@@ -19,8 +18,8 @@ linters-settings:
|
||||
misspell:
|
||||
locale: US
|
||||
issues:
|
||||
max-same: 0
|
||||
max-per-linter: 0
|
||||
max-same-issues: 0
|
||||
max-issues-per-linter: 0
|
||||
exclude-use-default: false
|
||||
exclude:
|
||||
# gosec: Duplicated errcheck checks
|
||||
|
||||
6
vendor/github.com/golang-migrate/migrate/v4/.goreleaser.yml
generated
vendored
6
vendor/github.com/golang-migrate/migrate/v4/.goreleaser.yml
generated
vendored
@@ -84,6 +84,10 @@ checksum:
|
||||
name_template: 'sha256sum.txt'
|
||||
release:
|
||||
draft: true
|
||||
prerelease: auto
|
||||
source:
|
||||
enabled: true
|
||||
format: zip
|
||||
changelog:
|
||||
skip: false
|
||||
sort: asc
|
||||
@@ -95,4 +99,4 @@ changelog:
|
||||
- Merge branch
|
||||
- go mod tidy
|
||||
snapshot:
|
||||
name_template: "{{ .Tag }}-next"
|
||||
name_template: "{{ .Tag }}-next"
|
||||
|
||||
9
vendor/github.com/golang-migrate/migrate/v4/Dockerfile.github-actions
generated
vendored
9
vendor/github.com/golang-migrate/migrate/v4/Dockerfile.github-actions
generated
vendored
@@ -2,7 +2,10 @@ FROM alpine:3.13
|
||||
|
||||
RUN apk add --no-cache ca-certificates
|
||||
|
||||
ENTRYPOINT ["/usr/bin/migrate"]
|
||||
CMD ["--help"]
|
||||
COPY migrate /usr/local/bin/migrate
|
||||
|
||||
COPY migrate /usr/bin/migrate
|
||||
RUN ln -s /usr/local/bin/migrate /usr/bin/migrate
|
||||
RUN ln -s /usr/local/bin/migrate /migrate
|
||||
|
||||
ENTRYPOINT ["migrate"]
|
||||
CMD ["--help"]
|
||||
14
vendor/github.com/golang-migrate/migrate/v4/Makefile
generated
vendored
14
vendor/github.com/golang-migrate/migrate/v4/Makefile
generated
vendored
@@ -6,12 +6,6 @@ TEST_FLAGS ?=
|
||||
REPO_OWNER ?= $(shell cd .. && basename "$$(pwd)")
|
||||
COVERAGE_DIR ?= .coverage
|
||||
|
||||
echo-source:
|
||||
@echo "$(SOURCE)"
|
||||
|
||||
echo-database:
|
||||
@echo "$(DATABASE)"
|
||||
|
||||
build:
|
||||
CGO_ENABLED=0 go build -ldflags='-X main.Version=$(VERSION)' -tags '$(DATABASE) $(SOURCE)' ./cmd/migrate
|
||||
|
||||
@@ -104,6 +98,12 @@ release:
|
||||
git tag v$(V)
|
||||
@read -p "Press enter to confirm and push to origin ..." && git push origin v$(V)
|
||||
|
||||
echo-source:
|
||||
@echo "$(SOURCE)"
|
||||
|
||||
echo-database:
|
||||
@echo "$(DATABASE)"
|
||||
|
||||
|
||||
define external_deps
|
||||
@echo '-- $(1)'; go list -f '{{join .Deps "\n"}}' $(1) | grep -v github.com/$(REPO_OWNER)/migrate | xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}'
|
||||
@@ -113,7 +113,7 @@ endef
|
||||
|
||||
.PHONY: build build-docker build-cli clean test-short test test-with-flags html-coverage \
|
||||
restore-import-paths rewrite-import-paths list-external-deps release \
|
||||
docs kill-docs open-docs kill-orphaned-docker-containers
|
||||
docs kill-docs open-docs kill-orphaned-docker-containers echo-source echo-database
|
||||
|
||||
SHELL = /bin/sh
|
||||
RAND = $(shell echo $$RANDOM)
|
||||
|
||||
8
vendor/github.com/golang-migrate/migrate/v4/README.md
generated
vendored
8
vendor/github.com/golang-migrate/migrate/v4/README.md
generated
vendored
@@ -1,9 +1,9 @@
|
||||
[](https://circleci.com/gh/golang-migrate/migrate)
|
||||
[](https://github.com/golang-migrate/migrate/actions/workflows/ci.yaml?query=branch%3Amaster)
|
||||
[](https://pkg.go.dev/github.com/golang-migrate/migrate/v4)
|
||||
[](https://coveralls.io/github/golang-migrate/migrate?branch=master)
|
||||
[](https://packagecloud.io/golang-migrate/migrate?filter=debs)
|
||||
[](https://hub.docker.com/r/migrate/migrate/)
|
||||

|
||||

|
||||
[](https://github.com/golang-migrate/migrate/releases)
|
||||
[](https://goreportcard.com/report/github.com/golang-migrate/migrate)
|
||||
|
||||
@@ -68,7 +68,9 @@ $
|
||||
Source drivers read migrations from local or remote sources. [Add a new source?](source/driver.go)
|
||||
|
||||
* [Filesystem](source/file) - read from filesystem
|
||||
* [io/fs](source/iofs) - read from a Go [io/fs](https://pkg.go.dev/io/fs#FS)
|
||||
* [Go-Bindata](source/go_bindata) - read from embedded binary data ([jteeuwen/go-bindata](https://github.com/jteeuwen/go-bindata))
|
||||
* [pkger](source/pkger) - read from embedded binary data ([markbates/pkger](https://github.com/markbates/pkger))
|
||||
* [GitHub](source/github) - read from remote GitHub repositories
|
||||
* [GitHub Enterprise](source/github_ee) - read from remote GitHub Enterprise repositories
|
||||
* [Bitbucket](source/bitbucket) - read from remote Bitbucket repositories
|
||||
@@ -140,7 +142,7 @@ func main() {
|
||||
m, err := migrate.NewWithDatabaseInstance(
|
||||
"file:///migrations",
|
||||
"postgres", driver)
|
||||
m.Steps(2)
|
||||
m.Up() // or m.Step(2) if you want to explicitly set the number of migrations to run
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
2
vendor/github.com/golang-migrate/migrate/v4/source/driver.go
generated
vendored
2
vendor/github.com/golang-migrate/migrate/v4/source/driver.go
generated
vendored
@@ -33,7 +33,7 @@ var drivers = make(map[string]Driver)
|
||||
// * Drivers are supposed to be read only.
|
||||
// * Ideally don't load any contents (into memory) in Open or WithInstance.
|
||||
type Driver interface {
|
||||
// Open returns a a new driver instance configured with parameters
|
||||
// Open returns a new driver instance configured with parameters
|
||||
// coming from the URL string. Migrate will call this function
|
||||
// only once per instance.
|
||||
Open(url string) (Driver, error)
|
||||
|
||||
22
vendor/github.com/golang-migrate/migrate/v4/source/file/file.go
generated
vendored
22
vendor/github.com/golang-migrate/migrate/v4/source/file/file.go
generated
vendored
@@ -6,12 +6,34 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/golang-migrate/migrate/v4/source"
|
||||
"github.com/golang-migrate/migrate/v4/source/iofs"
|
||||
)
|
||||
|
||||
func init() {
|
||||
source.Register("file", &File{})
|
||||
}
|
||||
|
||||
type File struct {
|
||||
iofs.PartialDriver
|
||||
url string
|
||||
path string
|
||||
}
|
||||
|
||||
func (f *File) Open(url string) (source.Driver, error) {
|
||||
p, err := parseURL(url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
nf := &File{
|
||||
url: url,
|
||||
path: p,
|
||||
}
|
||||
if err := nf.Init(os.DirFS(p), "."); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nf, nil
|
||||
}
|
||||
|
||||
func parseURL(url string) (string, error) {
|
||||
u, err := nurl.Parse(url)
|
||||
if err != nil {
|
||||
|
||||
32
vendor/github.com/golang-migrate/migrate/v4/source/file/file_go115.go
generated
vendored
32
vendor/github.com/golang-migrate/migrate/v4/source/file/file_go115.go
generated
vendored
@@ -1,32 +0,0 @@
|
||||
// +build !go1.16
|
||||
|
||||
package file
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/golang-migrate/migrate/v4/source"
|
||||
"github.com/golang-migrate/migrate/v4/source/httpfs"
|
||||
)
|
||||
|
||||
type File struct {
|
||||
httpfs.PartialDriver
|
||||
url string
|
||||
path string
|
||||
}
|
||||
|
||||
func (f *File) Open(url string) (source.Driver, error) {
|
||||
p, err := parseURL(url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
nf := &File{
|
||||
url: url,
|
||||
path: p,
|
||||
}
|
||||
if err := nf.Init(http.Dir(p), ""); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nf, nil
|
||||
}
|
||||
31
vendor/github.com/golang-migrate/migrate/v4/source/file/file_go116.go
generated
vendored
31
vendor/github.com/golang-migrate/migrate/v4/source/file/file_go116.go
generated
vendored
@@ -1,31 +0,0 @@
|
||||
// +build go1.16
|
||||
|
||||
package file
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/golang-migrate/migrate/v4/source"
|
||||
"github.com/golang-migrate/migrate/v4/source/iofs"
|
||||
)
|
||||
|
||||
type File struct {
|
||||
iofs.PartialDriver
|
||||
url string
|
||||
path string
|
||||
}
|
||||
|
||||
func (f *File) Open(url string) (source.Driver, error) {
|
||||
p, err := parseURL(url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
nf := &File{
|
||||
url: url,
|
||||
path: p,
|
||||
}
|
||||
if err := nf.Init(os.DirFS(p), "."); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nf, nil
|
||||
}
|
||||
49
vendor/github.com/golang-migrate/migrate/v4/source/httpfs/README.md
generated
vendored
49
vendor/github.com/golang-migrate/migrate/v4/source/httpfs/README.md
generated
vendored
@@ -1,49 +0,0 @@
|
||||
# httpfs
|
||||
|
||||
## Usage
|
||||
|
||||
This package could be used to create new migration source drivers that uses
|
||||
`http.FileSystem` to read migration files.
|
||||
|
||||
Struct `httpfs.PartialDriver` partly implements the `source.Driver` interface. It has all
|
||||
the methods except for `Open()`. Embedding this struct and adding `Open()` method
|
||||
allows users of this package to create new migration sources. Example:
|
||||
|
||||
```go
|
||||
struct mydriver {
|
||||
httpfs.PartialDriver
|
||||
}
|
||||
|
||||
func (d *mydriver) Open(url string) (source.Driver, error) {
|
||||
var fs http.FileSystem
|
||||
var path string
|
||||
var ds mydriver
|
||||
|
||||
// acquire fs and path from url
|
||||
// set-up ds if necessary
|
||||
|
||||
if err := ds.Init(fs, path); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ds, nil
|
||||
}
|
||||
```
|
||||
|
||||
This package also provides a simple `source.Driver` implementation that works
|
||||
with `http.FileSystem` provided by the user of this package. It is created with
|
||||
`httpfs.New()` call.
|
||||
|
||||
Example of using `http.Dir()` to read migrations from `sql` directory:
|
||||
|
||||
```go
|
||||
src, err := httpfs.New(http.Dir("sql"))
|
||||
if err != nil {
|
||||
// do something
|
||||
}
|
||||
m, err := migrate.NewWithSourceInstance("httpfs", src, "database://url")
|
||||
if err != nil {
|
||||
// do something
|
||||
}
|
||||
err = m.Up()
|
||||
...
|
||||
```
|
||||
31
vendor/github.com/golang-migrate/migrate/v4/source/httpfs/driver.go
generated
vendored
31
vendor/github.com/golang-migrate/migrate/v4/source/httpfs/driver.go
generated
vendored
@@ -1,31 +0,0 @@
|
||||
package httpfs
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"github.com/golang-migrate/migrate/v4/source"
|
||||
)
|
||||
|
||||
// driver is a migration source driver for reading migrations from
|
||||
// http.FileSystem instances. It implements source.Driver interface and can be
|
||||
// used as a migration source for the main migrate library.
|
||||
type driver struct {
|
||||
PartialDriver
|
||||
}
|
||||
|
||||
// New creates a new migrate source driver from a http.FileSystem instance and a
|
||||
// relative path to migration files within the virtual FS.
|
||||
func New(fs http.FileSystem, path string) (source.Driver, error) {
|
||||
var d driver
|
||||
if err := d.Init(fs, path); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
// Open completes the implementetion of source.Driver interface. Other methods
|
||||
// are implemented by the embedded PartialDriver struct.
|
||||
func (d *driver) Open(url string) (source.Driver, error) {
|
||||
return nil, errors.New("Open() cannot be called on the httpfs passthrough driver")
|
||||
}
|
||||
156
vendor/github.com/golang-migrate/migrate/v4/source/httpfs/partial_driver.go
generated
vendored
156
vendor/github.com/golang-migrate/migrate/v4/source/httpfs/partial_driver.go
generated
vendored
@@ -1,156 +0,0 @@
|
||||
package httpfs
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
|
||||
"github.com/golang-migrate/migrate/v4/source"
|
||||
)
|
||||
|
||||
// PartialDriver is a helper service for creating new source drivers working with
|
||||
// http.FileSystem instances. It implements all source.Driver interface methods
|
||||
// except for Open(). New driver could embed this struct and add missing Open()
|
||||
// method.
|
||||
//
|
||||
// To prepare PartialDriver for use Init() function.
|
||||
type PartialDriver struct {
|
||||
migrations *source.Migrations
|
||||
fs http.FileSystem
|
||||
path string
|
||||
}
|
||||
|
||||
// Init prepares not initialized PartialDriver instance to read migrations from a
|
||||
// http.FileSystem instance and a relative path.
|
||||
func (p *PartialDriver) Init(fs http.FileSystem, path string) error {
|
||||
root, err := fs.Open(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
files, err := root.Readdir(0)
|
||||
if err != nil {
|
||||
_ = root.Close()
|
||||
return err
|
||||
}
|
||||
if err = root.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ms := source.NewMigrations()
|
||||
for _, file := range files {
|
||||
if file.IsDir() {
|
||||
continue
|
||||
}
|
||||
|
||||
m, err := source.DefaultParse(file.Name())
|
||||
if err != nil {
|
||||
continue // ignore files that we can't parse
|
||||
}
|
||||
|
||||
if !ms.Append(m) {
|
||||
return source.ErrDuplicateMigration{
|
||||
Migration: *m,
|
||||
FileInfo: file,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p.fs = fs
|
||||
p.path = path
|
||||
p.migrations = ms
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close is part of source.Driver interface implementation. This is a no-op.
|
||||
func (p *PartialDriver) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// First is part of source.Driver interface implementation.
|
||||
func (p *PartialDriver) First() (version uint, err error) {
|
||||
if version, ok := p.migrations.First(); ok {
|
||||
return version, nil
|
||||
}
|
||||
return 0, &os.PathError{
|
||||
Op: "first",
|
||||
Path: p.path,
|
||||
Err: os.ErrNotExist,
|
||||
}
|
||||
}
|
||||
|
||||
// Prev is part of source.Driver interface implementation.
|
||||
func (p *PartialDriver) Prev(version uint) (prevVersion uint, err error) {
|
||||
if version, ok := p.migrations.Prev(version); ok {
|
||||
return version, nil
|
||||
}
|
||||
return 0, &os.PathError{
|
||||
Op: "prev for version " + strconv.FormatUint(uint64(version), 10),
|
||||
Path: p.path,
|
||||
Err: os.ErrNotExist,
|
||||
}
|
||||
}
|
||||
|
||||
// Next is part of source.Driver interface implementation.
|
||||
func (p *PartialDriver) Next(version uint) (nextVersion uint, err error) {
|
||||
if version, ok := p.migrations.Next(version); ok {
|
||||
return version, nil
|
||||
}
|
||||
return 0, &os.PathError{
|
||||
Op: "next for version " + strconv.FormatUint(uint64(version), 10),
|
||||
Path: p.path,
|
||||
Err: os.ErrNotExist,
|
||||
}
|
||||
}
|
||||
|
||||
// ReadUp is part of source.Driver interface implementation.
|
||||
func (p *PartialDriver) ReadUp(version uint) (r io.ReadCloser, identifier string, err error) {
|
||||
if m, ok := p.migrations.Up(version); ok {
|
||||
body, err := p.open(path.Join(p.path, m.Raw))
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return body, m.Identifier, nil
|
||||
}
|
||||
return nil, "", &os.PathError{
|
||||
Op: "read up for version " + strconv.FormatUint(uint64(version), 10),
|
||||
Path: p.path,
|
||||
Err: os.ErrNotExist,
|
||||
}
|
||||
}
|
||||
|
||||
// ReadDown is part of source.Driver interface implementation.
|
||||
func (p *PartialDriver) ReadDown(version uint) (r io.ReadCloser, identifier string, err error) {
|
||||
if m, ok := p.migrations.Down(version); ok {
|
||||
body, err := p.open(path.Join(p.path, m.Raw))
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return body, m.Identifier, nil
|
||||
}
|
||||
return nil, "", &os.PathError{
|
||||
Op: "read down for version " + strconv.FormatUint(uint64(version), 10),
|
||||
Path: p.path,
|
||||
Err: os.ErrNotExist,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *PartialDriver) open(path string) (http.File, error) {
|
||||
f, err := p.fs.Open(path)
|
||||
if err == nil {
|
||||
return f, nil
|
||||
}
|
||||
// Some non-standard file systems may return errors that don't include the path, that
|
||||
// makes debugging harder.
|
||||
if !errors.As(err, new(*os.PathError)) {
|
||||
err = &os.PathError{
|
||||
Op: "open",
|
||||
Path: path,
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
1
vendor/github.com/golang-migrate/migrate/v4/source/iofs/iofs.go
generated
vendored
1
vendor/github.com/golang-migrate/migrate/v4/source/iofs/iofs.go
generated
vendored
@@ -1,3 +1,4 @@
|
||||
//go:build go1.16
|
||||
// +build go1.16
|
||||
|
||||
package iofs
|
||||
|
||||
18
vendor/github.com/golang-migrate/migrate/v4/source/migration.go
generated
vendored
18
vendor/github.com/golang-migrate/migrate/v4/source/migration.go
generated
vendored
@@ -66,11 +66,13 @@ func (i *Migrations) Append(m *Migration) (ok bool) {
|
||||
}
|
||||
|
||||
func (i *Migrations) buildIndex() {
|
||||
i.index = make(uintSlice, 0)
|
||||
i.index = make(uintSlice, 0, len(i.migrations))
|
||||
for version := range i.migrations {
|
||||
i.index = append(i.index, version)
|
||||
}
|
||||
sort.Sort(i.index)
|
||||
sort.Slice(i.index, func(x, y int) bool {
|
||||
return i.index[x] < i.index[y]
|
||||
})
|
||||
}
|
||||
|
||||
func (i *Migrations) First() (version uint, ok bool) {
|
||||
@@ -126,18 +128,6 @@ func (i *Migrations) findPos(version uint) int {
|
||||
|
||||
type uintSlice []uint
|
||||
|
||||
func (s uintSlice) Len() int {
|
||||
return len(s)
|
||||
}
|
||||
|
||||
func (s uintSlice) Swap(i, j int) {
|
||||
s[i], s[j] = s[j], s[i]
|
||||
}
|
||||
|
||||
func (s uintSlice) Less(i, j int) bool {
|
||||
return s[i] < s[j]
|
||||
}
|
||||
|
||||
func (s uintSlice) Search(x uint) int {
|
||||
return sort.Search(len(s), func(i int) bool { return s[i] >= x })
|
||||
}
|
||||
|
||||
2
vendor/github.com/golang-migrate/migrate/v4/util.go
generated
vendored
2
vendor/github.com/golang-migrate/migrate/v4/util.go
generated
vendored
@@ -53,7 +53,7 @@ func FilterCustomQuery(u *nurl.URL) *nurl.URL {
|
||||
ux := *u
|
||||
vx := make(nurl.Values)
|
||||
for k, v := range ux.Query() {
|
||||
if len(k) <= 1 || (len(k) > 1 && k[0:2] != "x-") {
|
||||
if len(k) <= 1 || k[0:2] != "x-" {
|
||||
vx[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user