mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-06 11:02:41 +03:00
[rebase] Fix errors; update dependencies
Argument must be []byte not string Don't commit bomtest.txt
This commit is contained in:
21
vendor/github.com/spkg/bom/LICENSE.md
generated
vendored
Normal file
21
vendor/github.com/spkg/bom/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 John Jeffery
|
||||
|
||||
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.
|
39
vendor/github.com/spkg/bom/bom.go
generated
vendored
Normal file
39
vendor/github.com/spkg/bom/bom.go
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
// Package bom is used to clean up UTF-8 Byte Order Marks.
|
||||
package bom
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"io"
|
||||
)
|
||||
|
||||
const (
|
||||
bom0 = 0xef
|
||||
bom1 = 0xbb
|
||||
bom2 = 0xbf
|
||||
)
|
||||
|
||||
// Clean returns b with the 3 byte BOM stripped off the front if it is present.
|
||||
// If the BOM is not present, then b is returned.
|
||||
func Clean(b []byte) []byte {
|
||||
if len(b) >= 3 &&
|
||||
b[0] == bom0 &&
|
||||
b[1] == bom1 &&
|
||||
b[2] == bom2 {
|
||||
return b[3:]
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// NewReader returns an io.Reader that will skip over initial UTF-8 byte order marks.
|
||||
func NewReader(r io.Reader) io.Reader {
|
||||
buf := bufio.NewReader(r)
|
||||
b, err := buf.Peek(3)
|
||||
if err != nil {
|
||||
// not enough bytes
|
||||
return buf
|
||||
}
|
||||
if b[0] == bom0 && b[1] == bom1 && b[2] == bom2 {
|
||||
discardBytes(buf, 3)
|
||||
}
|
||||
return buf
|
||||
}
|
12
vendor/github.com/spkg/bom/discard_go14.go
generated
vendored
Normal file
12
vendor/github.com/spkg/bom/discard_go14.go
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// +build !go1.5
|
||||
|
||||
package bom
|
||||
|
||||
import "bufio"
|
||||
|
||||
func discardBytes(buf *bufio.Reader, n int) {
|
||||
// cannot use the buf.Discard method as it was introduced in Go 1.5
|
||||
for i := 0; i < n; i++ {
|
||||
buf.ReadByte()
|
||||
}
|
||||
}
|
10
vendor/github.com/spkg/bom/discard_go15.go
generated
vendored
Normal file
10
vendor/github.com/spkg/bom/discard_go15.go
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
// +build go1.5
|
||||
|
||||
package bom
|
||||
|
||||
import "bufio"
|
||||
|
||||
func discardBytes(buf *bufio.Reader, n int) {
|
||||
// the Discard method was introduced in Go 1.5
|
||||
buf.Discard(n)
|
||||
}
|
Reference in New Issue
Block a user