Update dependencies

This commit is contained in:
bluepython508
2025-04-09 01:00:12 +01:00
parent f0641ffd6e
commit 5a9cfc022c
882 changed files with 68930 additions and 24201 deletions

View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build plan9 || windows
// +build plan9 windows
package rand

View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || nacl || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd nacl netbsd openbsd solaris
package rand

View File

@@ -18,6 +18,7 @@ const (
defaultArchivePreReadSizeBytes = 1024
)
// ErrPreReadError indicates there was not enough underlying data to decompress.
var ErrPreReadError = errors.New("pre-read nothing")
// ArchiveReader reads from a io.Reader, decompresses source bytes
@@ -30,6 +31,7 @@ var ErrPreReadError = errors.New("pre-read nothing")
type ArchiveReader struct {
// src is where we read source bytes.
src io.Reader
// buf stores pre-read bytes from original io.Reader. Archive format
// detection will be done against it.
buf []byte
@@ -41,6 +43,7 @@ type ArchiveReader struct {
preReadSizeBytes int
}
// NewArchiveReader is a decompression reader.
func NewArchiveReader(r io.Reader) (ArchiveReader, error) {
ar := ArchiveReader{
src: r,
@@ -80,6 +83,7 @@ func NewArchiveReader(r io.Reader) (ArchiveReader, error) {
return ar, nil
}
// Read reads from the archive uncompressed.
func (ar ArchiveReader) Read(p []byte) (n int, err error) {
return ar.src.Read(p)
}

View File

@@ -8,8 +8,6 @@ import (
"encoding/binary"
"errors"
"fmt"
"github.com/josharian/native"
)
// Marshaler is the interface implemented by an object that can marshal itself
@@ -178,7 +176,7 @@ func NewBigEndianBuffer(b []byte) *Lexer {
func NewNativeEndianBuffer(b []byte) *Lexer {
return &Lexer{
Buffer: NewBuffer(b),
order: native.Endian,
order: binary.NativeEndian,
}
}

View File

@@ -1,57 +0,0 @@
// Copyright 2019 the u-root Authors. All rights reserved
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package uio
import (
"bytes"
"io"
)
// LineWriter processes one line of log output at a time.
type LineWriter interface {
// OneLine is always called with exactly one line of output.
OneLine(b []byte)
}
// FullLineWriter returns an io.Writer that waits for a full line of prints
// before calling w.Write on one line each.
func FullLineWriter(w LineWriter) io.WriteCloser {
return &fullLineWriter{w: w}
}
type fullLineWriter struct {
w LineWriter
buffer []byte
}
func (fsw *fullLineWriter) printBuf() {
bufs := bytes.Split(fsw.buffer, []byte{'\n'})
for _, buf := range bufs {
if len(buf) != 0 {
fsw.w.OneLine(buf)
}
}
fsw.buffer = nil
}
// Write implements io.Writer and buffers p until at least one full line is
// received.
func (fsw *fullLineWriter) Write(p []byte) (int, error) {
i := bytes.LastIndexByte(p, '\n')
if i == -1 {
fsw.buffer = append(fsw.buffer, p...)
} else {
fsw.buffer = append(fsw.buffer, p[:i]...)
fsw.printBuf()
fsw.buffer = append([]byte{}, p[i:]...)
}
return len(p), nil
}
// Close implements io.Closer and flushes the buffer.
func (fsw *fullLineWriter) Close() error {
fsw.printBuf()
return nil
}

View File

@@ -1,37 +0,0 @@
// Copyright 2019 the u-root Authors. All rights reserved
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package uio
import (
"io"
)
type multiCloser struct {
io.Writer
writers []io.Writer
}
// Close implements io.Closer and closes any io.Writers that are also
// io.Closers.
func (mc *multiCloser) Close() error {
var allErr error
for _, w := range mc.writers {
if c, ok := w.(io.Closer); ok {
if err := c.Close(); err != nil {
allErr = err
}
}
}
return allErr
}
// MultiWriteCloser is an io.MultiWriter that has an io.Closer and attempts to
// close those w's that have optional io.Closers.
func MultiWriteCloser(w ...io.Writer) io.WriteCloser {
return &multiCloser{
Writer: io.MultiWriter(w...),
writers: w,
}
}

View File

@@ -13,20 +13,24 @@ import (
"sync"
)
type devNull int
// devNull implements an io.Writer and io.ReaderFrom that discards any writes.
type devNull struct{}
// devNull implements ReaderFrom as an optimization so io.Copy to
// ioutil.Discard can avoid doing unnecessary work.
var _ io.ReaderFrom = devNull(0)
var _ io.ReaderFrom = devNull{}
// Write is an io.Writer.Write that discards data.
func (devNull) Write(p []byte) (int, error) {
return len(p), nil
}
// Name is like os.File.Name() and returns "null".
func (devNull) Name() string {
return "null"
}
// WriteString implements io.StringWriter and discards given data.
func (devNull) WriteString(s string) (int, error) {
return len(s), nil
}
@@ -38,6 +42,7 @@ var blackHolePool = sync.Pool{
},
}
// ReadFrom implements io.ReaderFrom and discards data being read.
func (devNull) ReadFrom(r io.Reader) (n int64, err error) {
bufp := blackHolePool.Get().(*[]byte)
var readSize int
@@ -54,6 +59,7 @@ func (devNull) ReadFrom(r io.Reader) (n int64, err error) {
}
}
// Close does nothing.
func (devNull) Close() error {
return nil
}
@@ -67,4 +73,4 @@ type WriteNameCloser interface {
// Discard is a WriteNameCloser on which all Write and Close calls succeed
// without doing anything, and the Name call returns "null".
var Discard WriteNameCloser = devNull(0)
var Discard WriteNameCloser = devNull{}

View File

@@ -36,7 +36,7 @@ func (rc *ProgressReadCloser) Read(p []byte) (n int, err error) {
return rc.RC.Read(p)
}
// Read implements io.Closer for ProgressReader.
// Close implements io.Closer for ProgressReader.
func (rc *ProgressReadCloser) Close() error {
return rc.RC.Close()
}