diff options
author | 2025-03-09 17:47:56 +0100 | |
---|---|---|
committer | 2025-03-10 01:59:49 +0100 | |
commit | 3ac1ee16f377d31a0fb80c8dae28b6239ac4229e (patch) | |
tree | f61faa581feaaeaba2542b9f2b8234a590684413 /vendor/github.com/jackc/pgservicefile | |
parent | [chore] update URLs to forked source (diff) | |
download | gotosocial-3ac1ee16f377d31a0fb80c8dae28b6239ac4229e.tar.xz |
[chore] remove vendor
Diffstat (limited to 'vendor/github.com/jackc/pgservicefile')
-rw-r--r-- | vendor/github.com/jackc/pgservicefile/LICENSE | 22 | ||||
-rw-r--r-- | vendor/github.com/jackc/pgservicefile/README.md | 7 | ||||
-rw-r--r-- | vendor/github.com/jackc/pgservicefile/pgservicefile.go | 81 |
3 files changed, 0 insertions, 110 deletions
diff --git a/vendor/github.com/jackc/pgservicefile/LICENSE b/vendor/github.com/jackc/pgservicefile/LICENSE deleted file mode 100644 index f1b4c2892..000000000 --- a/vendor/github.com/jackc/pgservicefile/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2020 Jack Christensen - -MIT License - -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/jackc/pgservicefile/README.md b/vendor/github.com/jackc/pgservicefile/README.md deleted file mode 100644 index 2fc7e012c..000000000 --- a/vendor/github.com/jackc/pgservicefile/README.md +++ /dev/null @@ -1,7 +0,0 @@ -[](https://pkg.go.dev/github.com/jackc/pgservicefile) -[](https://github.com/jackc/pgservicefile/actions/workflows/ci.yml) - - -# pgservicefile - -Package pgservicefile is a parser for PostgreSQL service files (e.g. `.pg_service.conf`). diff --git a/vendor/github.com/jackc/pgservicefile/pgservicefile.go b/vendor/github.com/jackc/pgservicefile/pgservicefile.go deleted file mode 100644 index c62caa7fe..000000000 --- a/vendor/github.com/jackc/pgservicefile/pgservicefile.go +++ /dev/null @@ -1,81 +0,0 @@ -// Package pgservicefile is a parser for PostgreSQL service files (e.g. .pg_service.conf). -package pgservicefile - -import ( - "bufio" - "errors" - "fmt" - "io" - "os" - "strings" -) - -type Service struct { - Name string - Settings map[string]string -} - -type Servicefile struct { - Services []*Service - servicesByName map[string]*Service -} - -// GetService returns the named service. -func (sf *Servicefile) GetService(name string) (*Service, error) { - service, present := sf.servicesByName[name] - if !present { - return nil, errors.New("not found") - } - return service, nil -} - -// ReadServicefile reads the file at path and parses it into a Servicefile. -func ReadServicefile(path string) (*Servicefile, error) { - f, err := os.Open(path) - if err != nil { - return nil, err - } - defer f.Close() - - return ParseServicefile(f) -} - -// ParseServicefile reads r and parses it into a Servicefile. -func ParseServicefile(r io.Reader) (*Servicefile, error) { - servicefile := &Servicefile{} - - var service *Service - scanner := bufio.NewScanner(r) - lineNum := 0 - for scanner.Scan() { - lineNum += 1 - line := scanner.Text() - line = strings.TrimSpace(line) - - if line == "" || strings.HasPrefix(line, "#") { - // ignore comments and empty lines - } else if strings.HasPrefix(line, "[") && strings.HasSuffix(line, "]") { - service = &Service{Name: line[1 : len(line)-1], Settings: make(map[string]string)} - servicefile.Services = append(servicefile.Services, service) - } else if service != nil { - parts := strings.SplitN(line, "=", 2) - if len(parts) != 2 { - return nil, fmt.Errorf("unable to parse line %d", lineNum) - } - - key := strings.TrimSpace(parts[0]) - value := strings.TrimSpace(parts[1]) - - service.Settings[key] = value - } else { - return nil, fmt.Errorf("line %d is not in a section", lineNum) - } - } - - servicefile.servicesByName = make(map[string]*Service, len(servicefile.Services)) - for _, service := range servicefile.Services { - servicefile.servicesByName[service.Name] = service - } - - return servicefile, scanner.Err() -} |