4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-07-10 09:26:27 +00:00

Update dependencies and build to go1.22 (#2113)

* Update dependencies and build to go1.22

* Fix api changes wrt to dependencies

* Update golangci config
This commit is contained in:
Wim
2024-05-23 23:44:31 +02:00
committed by GitHub
parent 56e7bd01ca
commit 2f33fe86f5
1556 changed files with 3279522 additions and 1924375 deletions

21
vendor/github.com/sagikazarmark/locafero/.editorconfig generated vendored Normal file
View File

@ -0,0 +1,21 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[{Makefile,*.mk}]
indent_style = tab
[*.nix]
indent_size = 2
[*.go]
indent_style = tab
[{*.yml,*.yaml}]
indent_size = 2

4
vendor/github.com/sagikazarmark/locafero/.envrc generated vendored Normal file
View File

@ -0,0 +1,4 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
fi
use flake . --impure

8
vendor/github.com/sagikazarmark/locafero/.gitignore generated vendored Normal file
View File

@ -0,0 +1,8 @@
/.devenv/
/.direnv/
/.task/
/bin/
/build/
/tmp/
/var/
/vendor/

View File

@ -0,0 +1,27 @@
run:
timeout: 10m
linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/sagikazarmark/locafero)
goimports:
local-prefixes: github.com/sagikazarmark/locafero
misspell:
locale: US
nolintlint:
allow-leading-space: false # require machine-readable nolint directives (with no leading space)
allow-unused: false # report any unused nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
revive:
confidence: 0
linters:
enable:
- gci
- goimports
- misspell
- nolintlint
- revive

19
vendor/github.com/sagikazarmark/locafero/LICENSE generated vendored Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2023 Márk Sági-Kazár <mark.sagikazar@gmail.com>
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.

37
vendor/github.com/sagikazarmark/locafero/README.md generated vendored Normal file
View File

@ -0,0 +1,37 @@
# Finder library for [Afero](https://github.com/spf13/afero)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/sagikazarmark/locafero/ci.yaml?style=flat-square)](https://github.com/sagikazarmark/locafero/actions/workflows/ci.yaml)
[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/mod/github.com/sagikazarmark/locafero)
![Go Version](https://img.shields.io/badge/go%20version-%3E=1.20-61CFDD.svg?style=flat-square)
[![built with nix](https://img.shields.io/badge/builtwith-nix-7d81f7?style=flat-square)](https://builtwithnix.org)
**Finder library for [Afero](https://github.com/spf13/afero) ported from [go-finder](https://github.com/sagikazarmark/go-finder).**
> [!WARNING]
> This is an experimental library under development.
>
> **Backwards compatibility is not guaranteed, expect breaking changes.**
## Installation
```shell
go get github.com/sagikazarmark/locafero
```
## Usage
Check out the [package example](https://pkg.go.dev/github.com/sagikazarmark/locafero#example-package) on go.dev.
## Development
**For an optimal developer experience, it is recommended to install [Nix](https://nixos.org/download.html) and [direnv](https://direnv.net/docs/installation.html).**
Run the test suite:
```shell
just test
```
## License
The project is licensed under the [MIT License](LICENSE).

28
vendor/github.com/sagikazarmark/locafero/file_type.go generated vendored Normal file
View File

@ -0,0 +1,28 @@
package locafero
import "io/fs"
// FileType represents the kind of entries [Finder] can return.
type FileType int
const (
FileTypeAll FileType = iota
FileTypeFile
FileTypeDir
)
func (ft FileType) matchFileInfo(info fs.FileInfo) bool {
switch ft {
case FileTypeAll:
return true
case FileTypeFile:
return !info.IsDir()
case FileTypeDir:
return info.IsDir()
default:
return false
}
}

165
vendor/github.com/sagikazarmark/locafero/finder.go generated vendored Normal file
View File

@ -0,0 +1,165 @@
// Package finder looks for files and directories in an {fs.Fs} filesystem.
package locafero
import (
"errors"
"io/fs"
"path/filepath"
"strings"
"github.com/sourcegraph/conc/iter"
"github.com/spf13/afero"
)
// Finder looks for files and directories in an [afero.Fs] filesystem.
type Finder struct {
// Paths represents a list of locations that the [Finder] will search in.
//
// They are essentially the root directories or starting points for the search.
//
// Examples:
// - home/user
// - etc
Paths []string
// Names are specific entries that the [Finder] will look for within the given Paths.
//
// It provides the capability to search for entries with depth,
// meaning it can target deeper locations within the directory structure.
//
// It also supports glob syntax (as defined by [filepat.Match]), offering greater flexibility in search patterns.
//
// Examples:
// - config.yaml
// - home/*/config.yaml
// - home/*/config.*
Names []string
// Type restricts the kind of entries returned by the [Finder].
//
// This parameter helps in differentiating and filtering out files from directories or vice versa.
Type FileType
}
// Find looks for files and directories in an [afero.Fs] filesystem.
func (f Finder) Find(fsys afero.Fs) ([]string, error) {
// Arbitrary go routine limit (TODO: make this a parameter)
// pool := pool.NewWithResults[[]string]().WithMaxGoroutines(5).WithErrors().WithFirstError()
type searchItem struct {
path string
name string
}
var searchItems []searchItem
for _, searchPath := range f.Paths {
searchPath := searchPath
for _, searchName := range f.Names {
searchName := searchName
searchItems = append(searchItems, searchItem{searchPath, searchName})
// pool.Go(func() ([]string, error) {
// // If the name contains any glob character, perform a glob match
// if strings.ContainsAny(searchName, "*?[]\\^") {
// return globWalkSearch(fsys, searchPath, searchName, f.Type)
// }
//
// return statSearch(fsys, searchPath, searchName, f.Type)
// })
}
}
// allResults, err := pool.Wait()
// if err != nil {
// return nil, err
// }
allResults, err := iter.MapErr(searchItems, func(item *searchItem) ([]string, error) {
// If the name contains any glob character, perform a glob match
if strings.ContainsAny(item.name, "*?[]\\^") {
return globWalkSearch(fsys, item.path, item.name, f.Type)
}
return statSearch(fsys, item.path, item.name, f.Type)
})
if err != nil {
return nil, err
}
var results []string
for _, r := range allResults {
results = append(results, r...)
}
// Sort results in alphabetical order for now
// sort.Strings(results)
return results, nil
}
func globWalkSearch(fsys afero.Fs, searchPath string, searchName string, searchType FileType) ([]string, error) {
var results []string
err := afero.Walk(fsys, searchPath, func(p string, fileInfo fs.FileInfo, err error) error {
if err != nil {
return err
}
// Skip the root path
if p == searchPath {
return nil
}
var result error
// Stop reading subdirectories
// TODO: add depth detection here
if fileInfo.IsDir() && filepath.Dir(p) == searchPath {
result = fs.SkipDir
}
// Skip unmatching type
if !searchType.matchFileInfo(fileInfo) {
return result
}
match, err := filepath.Match(searchName, fileInfo.Name())
if err != nil {
return err
}
if match {
results = append(results, p)
}
return result
})
if err != nil {
return results, err
}
return results, nil
}
func statSearch(fsys afero.Fs, searchPath string, searchName string, searchType FileType) ([]string, error) {
filePath := filepath.Join(searchPath, searchName)
fileInfo, err := fsys.Stat(filePath)
if errors.Is(err, fs.ErrNotExist) {
return nil, nil
}
if err != nil {
return nil, err
}
// Skip unmatching type
if !searchType.matchFileInfo(fileInfo) {
return nil, nil
}
return []string{filePath}, nil
}

273
vendor/github.com/sagikazarmark/locafero/flake.lock generated vendored Normal file
View File

@ -0,0 +1,273 @@
{
"nodes": {
"devenv": {
"inputs": {
"flake-compat": "flake-compat",
"nix": "nix",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1694097209,
"narHash": "sha256-gQmBjjxeSyySjbh0yQVBKApo2KWIFqqbRUvG+Fa+QpM=",
"owner": "cachix",
"repo": "devenv",
"rev": "7a8e6a91510efe89d8dcb8e43233f93e86f6b189",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1693611461,
"narHash": "sha256-aPODl8vAgGQ0ZYFIRisxYG5MOGSkIczvu2Cd8Gb9+1Y=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "7f53fdb7bdc5bb237da7fefef12d099e4fd611ca",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"devenv",
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1660459072,
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"lowdown-src": {
"flake": false,
"locked": {
"lastModified": 1633514407,
"narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=",
"owner": "kristapsdz",
"repo": "lowdown",
"rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8",
"type": "github"
},
"original": {
"owner": "kristapsdz",
"repo": "lowdown",
"type": "github"
}
},
"nix": {
"inputs": {
"lowdown-src": "lowdown-src",
"nixpkgs": [
"devenv",
"nixpkgs"
],
"nixpkgs-regression": "nixpkgs-regression"
},
"locked": {
"lastModified": 1676545802,
"narHash": "sha256-EK4rZ+Hd5hsvXnzSzk2ikhStJnD63odF7SzsQ8CuSPU=",
"owner": "domenkozar",
"repo": "nix",
"rev": "7c91803598ffbcfe4a55c44ac6d49b2cf07a527f",
"type": "github"
},
"original": {
"owner": "domenkozar",
"ref": "relaxed-flakes",
"repo": "nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1678875422,
"narHash": "sha256-T3o6NcQPwXjxJMn2shz86Chch4ljXgZn746c2caGxd8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "126f49a01de5b7e35a43fd43f891ecf6d3a51459",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1693471703,
"narHash": "sha256-0l03ZBL8P1P6z8MaSDS/MvuU8E75rVxe5eE1N6gxeTo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3e52e76b70d5508f3cec70b882a29199f4d1ee85",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-regression": {
"locked": {
"lastModified": 1643052045,
"narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1685801374,
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1694343207,
"narHash": "sha256-jWi7OwFxU5Owi4k2JmiL1sa/OuBCQtpaAesuj5LXC8w=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "78058d810644f5ed276804ce7ea9e82d92bee293",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": [
"devenv",
"flake-compat"
],
"flake-utils": "flake-utils",
"gitignore": "gitignore",
"nixpkgs": [
"devenv",
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1688056373,
"narHash": "sha256-2+SDlNRTKsgo3LBRiMUcoEUb6sDViRNQhzJquZ4koOI=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "5843cf069272d92b60c3ed9e55b7a8989c01d4c7",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs_2"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

47
vendor/github.com/sagikazarmark/locafero/flake.nix generated vendored Normal file
View File

@ -0,0 +1,47 @@
{
description = "Finder library for Afero";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
devenv.url = "github:cachix/devenv";
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.devenv.flakeModule
];
systems = [ "x86_64-linux" "aarch64-darwin" ];
perSystem = { config, self', inputs', pkgs, system, ... }: rec {
devenv.shells = {
default = {
languages = {
go.enable = true;
};
packages = with pkgs; [
just
golangci-lint
];
# https://github.com/cachix/devenv/issues/528#issuecomment-1556108767
containers = pkgs.lib.mkForce { };
};
ci = devenv.shells.default;
ci_1_20 = {
imports = [ devenv.shells.ci ];
languages = {
go.package = pkgs.go_1_20;
};
};
};
};
};
}

41
vendor/github.com/sagikazarmark/locafero/helpers.go generated vendored Normal file
View File

@ -0,0 +1,41 @@
package locafero
import "fmt"
// NameWithExtensions creates a list of names from a base name and a list of extensions.
//
// TODO: find a better name for this function.
func NameWithExtensions(baseName string, extensions ...string) []string {
var names []string
if baseName == "" {
return names
}
for _, ext := range extensions {
if ext == "" {
continue
}
names = append(names, fmt.Sprintf("%s.%s", baseName, ext))
}
return names
}
// NameWithOptionalExtensions creates a list of names from a base name and a list of extensions,
// plus it adds the base name (without any extensions) to the end of the list.
//
// TODO: find a better name for this function.
func NameWithOptionalExtensions(baseName string, extensions ...string) []string {
var names []string
if baseName == "" {
return names
}
names = NameWithExtensions(baseName, extensions...)
names = append(names, baseName)
return names
}

11
vendor/github.com/sagikazarmark/locafero/justfile generated vendored Normal file
View File

@ -0,0 +1,11 @@
default:
just --list
test:
go test -race -v ./...
lint:
golangci-lint run
fmt:
golangci-lint run --fix