go.modgo.summodules.txt
vendor
dario.cat
github.com
ProtonMail
go-crypto
ocb
openpgp
armor
canonical_text.goecdh
ed25519
ed448
errors
internal
key_generation.gokeys.gopacket
aead_crypter.gocompressed.goconfig.goconfig_v5.goencrypted_key.goliteral.gomarker.goone_pass_signature.goopaque.gopacket.gopacket_sequence.gopacket_unsupported.gopadding.goprivate_key.gopublic_key.goreader.gorecipient.gosignature.gosymmetric_key_encrypted.gosymmetrically_encrypted.gosymmetrically_encrypted_aead.gosymmetrically_encrypted_mdc.gouserattribute.gouserid.go
read.goread_write_test_data.gos2k
write.gox25519
x448
charmbracelet
lipgloss
x
ansi
cloudflare
containerd
containerd
cyphar
filepath-securejoin
docker
cli
docker
go-git
go-billy
go-viper
mapstructure
grpc-ecosystem
grpc-gateway
klauspost
compress
mattn
go-runewidth
moby
sys
prometheus
schollz
progressbar
skeema
knownhosts
stretchr
go.opentelemetry.io
contrib
instrumentation
net
http
otelhttp
otel
.gitignore.golangci.ymlCHANGELOG.mdCODEOWNERSCONTRIBUTING.mdMakefileREADME.mdRELEASING.md
attribute
baggage
codes
doc.goexporters
otlp
otlpmetric
otlpmetricgrpc
otlptrace
internal
metric
renovate.jsonsdk
instrumentation
metric
config.godoc.goexemplar.gomanual_reader.gometer.goperiodic_reader.gopipeline.goprovider.goreader.goversion.goview.go
exemplar
README.mddoc.goexemplar.gofilter.gofixed_size_reservoir.gohistogram_reservoir.goreservoir.gostorage.govalue.go
instrument.gointernal
aggregate
aggregate.godrop.goexemplar.goexponential_histogram.gofiltered_reservoir.gohistogram.golastvalue.gosum.go
exemplar
x
resource
trace
version.gosemconv
trace
verify_examples.shverify_released_changelog.shversion.goversions.yamlgolang.org
x
crypto
exp
net
LICENSE
http2
sync
sys
LICENSE
cpu
asm_darwin_x86_gc.scpu.gocpu_arm64.gocpu_darwin_x86.gocpu_gc_x86.gocpu_gc_x86.scpu_gccgo_x86.gocpu_linux_arm64.gocpu_linux_noinit.gocpu_linux_riscv64.gocpu_other_x86.gocpu_riscv64.gocpu_x86.gosyscall_darwin_x86_gc.go
unix
README.mdioctl_linux.gomkerrors.shsyscall_aix.gosyscall_darwin.gosyscall_hurd.gosyscall_linux.gosyscall_linux_arm64.gosyscall_linux_loong64.gosyscall_linux_riscv64.gosyscall_openbsd.gosyscall_zos_s390x.govgetrandom_linux.govgetrandom_unsupported.gozerrors_darwin_amd64.gozerrors_darwin_arm64.gozerrors_linux.gozerrors_linux_386.gozerrors_linux_amd64.gozerrors_linux_arm.gozerrors_linux_arm64.gozerrors_linux_loong64.gozerrors_linux_mips.gozerrors_linux_mips64.gozerrors_linux_mips64le.gozerrors_linux_mipsle.gozerrors_linux_ppc.gozerrors_linux_ppc64.gozerrors_linux_ppc64le.gozerrors_linux_riscv64.gozerrors_linux_s390x.gozerrors_linux_sparc64.gozerrors_zos_s390x.gozsyscall_darwin_amd64.gozsyscall_darwin_amd64.szsyscall_darwin_arm64.gozsyscall_darwin_arm64.szsyscall_linux.gozsyscall_openbsd_386.gozsyscall_openbsd_386.szsyscall_openbsd_amd64.gozsyscall_openbsd_amd64.szsyscall_openbsd_arm.gozsyscall_openbsd_arm.szsyscall_openbsd_arm64.gozsyscall_openbsd_arm64.szsyscall_openbsd_mips64.gozsyscall_openbsd_mips64.szsyscall_openbsd_ppc64.gozsyscall_openbsd_ppc64.szsyscall_openbsd_riscv64.gozsyscall_openbsd_riscv64.szsysnum_linux_386.gozsysnum_linux_amd64.gozsysnum_linux_arm.gozsysnum_linux_arm64.gozsysnum_linux_loong64.gozsysnum_linux_mips.gozsysnum_linux_mips64.gozsysnum_linux_mips64le.gozsysnum_linux_mipsle.gozsysnum_linux_ppc.gozsysnum_linux_ppc64.gozsysnum_linux_ppc64le.gozsysnum_linux_riscv64.gozsysnum_linux_s390x.gozsysnum_linux_sparc64.goztypes_darwin_amd64.goztypes_darwin_arm64.goztypes_freebsd_386.goztypes_freebsd_amd64.goztypes_freebsd_arm.goztypes_freebsd_arm64.goztypes_freebsd_riscv64.goztypes_linux.goztypes_linux_riscv64.goztypes_zos_s390x.go
windows
term
text
time
google.golang.org
grpc
CONTRIBUTING.mdMAINTAINERS.mdSECURITY.mdclientconn.gocodec.go
backoff
balancer
balancer_wrapper.gobinarylog
grpc_binarylog_v1
credentials
dialoptions.godoc.goencoding
experimental
grpclog
health
grpc_health_v1
internal
balancer
gracefulswitch
binarylog
channelz
envconfig
experimental.gogrpclog
grpcsync
grpcutil
idle
internal.goresolver
stats
status
syscall
tcp_keepalive_unix.gotcp_keepalive_windows.gotransport
keepalive
mem
metadata
preloader.goregenerate.shresolver_wrapper.gorpc_util.goserver.goshared_buffer_pool.gostats
stream.gostream_interfaces.goversion.goprotobuf
encoding
internal
descopts
editiondefaults
filedesc
genid
impl
codec_extension.gocodec_field.gocodec_message.gocodec_reflect.gocodec_unsafe.goconvert.goencode.goequal.golegacy_extension.gomessage.gopointer_reflect.gopointer_unsafe.go
strs
version
proto
reflect
runtime
protoiface
types
known
anypb
durationpb
fieldmaskpb
structpb
timestamppb
wrapperspb
35
vendor/github.com/go-git/go-billy/v5/util/util.go
generated
vendored
35
vendor/github.com/go-git/go-billy/v5/util/util.go
generated
vendored
@ -1,6 +1,7 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -33,14 +34,14 @@ func removeAll(fs billy.Basic, path string) error {
|
||||
|
||||
// Simple case: if Remove works, we're done.
|
||||
err := fs.Remove(path)
|
||||
if err == nil || os.IsNotExist(err) {
|
||||
if err == nil || errors.Is(err, os.ErrNotExist) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Otherwise, is this a directory we need to recurse into?
|
||||
dir, serr := fs.Stat(path)
|
||||
if serr != nil {
|
||||
if os.IsNotExist(serr) {
|
||||
if errors.Is(serr, os.ErrNotExist) {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -60,7 +61,7 @@ func removeAll(fs billy.Basic, path string) error {
|
||||
// Directory.
|
||||
fis, err := dirfs.ReadDir(path)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
// Race. It was deleted between the Lstat and Open.
|
||||
// Return nil per RemoveAll's docs.
|
||||
return nil
|
||||
@ -81,7 +82,7 @@ func removeAll(fs billy.Basic, path string) error {
|
||||
|
||||
// Remove directory.
|
||||
err1 := fs.Remove(path)
|
||||
if err1 == nil || os.IsNotExist(err1) {
|
||||
if err1 == nil || errors.Is(err1, os.ErrNotExist) {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -96,22 +97,26 @@ func removeAll(fs billy.Basic, path string) error {
|
||||
// WriteFile writes data to a file named by filename in the given filesystem.
|
||||
// If the file does not exist, WriteFile creates it with permissions perm;
|
||||
// otherwise WriteFile truncates it before writing.
|
||||
func WriteFile(fs billy.Basic, filename string, data []byte, perm os.FileMode) error {
|
||||
func WriteFile(fs billy.Basic, filename string, data []byte, perm os.FileMode) (err error) {
|
||||
f, err := fs.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if f != nil {
|
||||
err1 := f.Close()
|
||||
if err == nil {
|
||||
err = err1
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
n, err := f.Write(data)
|
||||
if err == nil && n < len(data) {
|
||||
err = io.ErrShortWrite
|
||||
}
|
||||
|
||||
if err1 := f.Close(); err == nil {
|
||||
err = err1
|
||||
}
|
||||
|
||||
return err
|
||||
return nil
|
||||
}
|
||||
|
||||
// Random number state.
|
||||
@ -154,7 +159,7 @@ func TempFile(fs billy.Basic, dir, prefix string) (f billy.File, err error) {
|
||||
for i := 0; i < 10000; i++ {
|
||||
name := filepath.Join(dir, prefix+nextSuffix())
|
||||
f, err = fs.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600)
|
||||
if os.IsExist(err) {
|
||||
if errors.Is(err, os.ErrExist) {
|
||||
if nconflict++; nconflict > 10 {
|
||||
randmu.Lock()
|
||||
rand = reseed()
|
||||
@ -185,7 +190,7 @@ func TempDir(fs billy.Dir, dir, prefix string) (name string, err error) {
|
||||
for i := 0; i < 10000; i++ {
|
||||
try := filepath.Join(dir, prefix+nextSuffix())
|
||||
err = fs.MkdirAll(try, 0700)
|
||||
if os.IsExist(err) {
|
||||
if errors.Is(err, os.ErrExist) {
|
||||
if nconflict++; nconflict > 10 {
|
||||
randmu.Lock()
|
||||
rand = reseed()
|
||||
@ -193,8 +198,8 @@ func TempDir(fs billy.Dir, dir, prefix string) (name string, err error) {
|
||||
}
|
||||
continue
|
||||
}
|
||||
if os.IsNotExist(err) {
|
||||
if _, err := os.Stat(dir); os.IsNotExist(err) {
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
if _, err := os.Stat(dir); errors.Is(err, os.ErrNotExist) {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
@ -272,7 +277,7 @@ func ReadFile(fs billy.Basic, name string) ([]byte, error) {
|
||||
data = data[:len(data)+n]
|
||||
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
if errors.Is(err, io.EOF) {
|
||||
err = nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user