From 3d8ea383579a922f7aaedbfd5f86cbfb4c6b452e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 11 Oct 2026 03:52:54 +0000 Subject: [PATCH 1/2] build(deps): bump github.com/Microsoft/go-winio Bumps [github.com/Microsoft/go-winio](https://github.com/Microsoft/go-winio) from 0.6.3-0.20260917205003-526e22f39a0a to 0.6.3. - [Release notes](https://github.com/Microsoft/go-winio/releases) - [Commits](https://github.com/Microsoft/go-winio/commits/v0.6.3) --- updated-dependencies: - dependency-name: github.com/Microsoft/go-winio dependency-version: 0.6.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 6 +- go.sum | 12 +- .../Microsoft/go-winio/.golangci.yml | 270 ++++++++++-------- .../github.com/Microsoft/go-winio/backup.go | 2 +- .../Microsoft/go-winio/backuptar/strconv.go | 4 +- .../Microsoft/go-winio/backuptar/tar.go | 5 +- vendor/github.com/Microsoft/go-winio/ea.go | 2 +- vendor/github.com/Microsoft/go-winio/file.go | 47 ++- .../github.com/Microsoft/go-winio/hvsock.go | 2 +- .../Microsoft/go-winio/internal/fs/fs.go | 2 +- .../go-winio/internal/fs/zsyscall_windows.go | 8 +- .../internal/socket/zsyscall_windows.go | 8 +- .../go-winio/internal/stringbuffer/wstring.go | 4 +- vendor/github.com/Microsoft/go-winio/pipe.go | 60 ++-- .../go-winio/pkg/bindfilter/bind_filter.go | 8 +- .../pkg/bindfilter/zsyscall_windows.go | 8 +- .../go-winio/pkg/etw/eventdescriptor.go | 8 +- .../go-winio/pkg/etw/eventmetadata.go | 4 - .../Microsoft/go-winio/pkg/etw/fieldopt.go | 6 +- .../go-winio/pkg/etw/level_string.go | 5 +- .../go-winio/pkg/etw/opcode_string.go | 5 +- .../Microsoft/go-winio/pkg/etw/provider.go | 1 - .../go-winio/pkg/etw/providerglobal.go | 2 +- .../go-winio/pkg/etw/zsyscall_windows.go | 8 +- .../Microsoft/go-winio/pkg/etwlogrus/hook.go | 4 +- .../Microsoft/go-winio/pkg/guid/guid.go | 2 +- .../go-winio/pkg/guid/variant_string.go | 5 +- .../go-winio/pkg/process/zsyscall_windows.go | 8 +- .../tools/mkwinsyscall/mkwinsyscall.go | 36 ++- .../Microsoft/go-winio/vhd/zvhd_windows.go | 8 +- .../Microsoft/go-winio/zsyscall_windows.go | 8 +- .../github.com/sirupsen/logrus/CHANGELOG.md | 15 + vendor/github.com/sirupsen/logrus/entry.go | 60 ++-- vendor/github.com/sirupsen/logrus/exported.go | 2 +- .../sirupsen/logrus/text_formatter.go | 28 +- .../x/tools/go/ast/astutil/imports.go | 10 +- .../x/tools/go/gcexportdata/gcexportdata.go | 103 +++---- .../x/tools/internal/gcimporter/iexport.go | 22 +- .../x/tools/internal/gcimporter/iimport.go | 14 +- .../x/tools/internal/gcimporter/ureader.go | 53 +++- .../x/tools/internal/imports/fix.go | 33 ++- .../x/tools/internal/imports/sortimports.go | 10 +- .../x/tools/internal/modindex/index.go | 48 +++- .../x/tools/internal/pkgbits/version.go | 9 + .../x/tools/internal/stdlib/deps.go | 6 +- .../x/tools/internal/typesinternal/types.go | 2 + vendor/modules.txt | 10 +- 47 files changed, 551 insertions(+), 432 deletions(-) diff --git a/go.mod b/go.mod index 806d22309b..7458063f6d 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ tool ( require ( github.com/Microsoft/cosesign1go v1.7.0 github.com/Microsoft/didx509go v0.0.3 - github.com/Microsoft/go-winio v0.6.3-0.20260917205003-526e22f39a0a + github.com/Microsoft/go-winio v0.6.3 github.com/blang/semver/v4 v4.0.0 github.com/cenkalti/backoff/v4 v4.3.0 github.com/containerd/cgroups/v3 v3.1.3 @@ -52,7 +52,7 @@ require ( github.com/pelletier/go-toml v1.9.5 github.com/pkg/errors v0.9.1 github.com/samber/lo v1.53.0 - github.com/sirupsen/logrus v1.10.0 + github.com/sirupsen/logrus v1.10.2 github.com/urfave/cli v1.22.17 github.com/urfave/cli/v2 v2.27.7 github.com/vishvananda/netlink v1.3.1 @@ -134,7 +134,7 @@ require ( golang.org/x/crypto v0.57.0 // indirect golang.org/x/mod v0.41.0 // indirect golang.org/x/text v0.42.0 // indirect - golang.org/x/tools v0.49.0 // indirect + golang.org/x/tools v0.50.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260825221802-da73d73af1c5 // indirect google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.2 // indirect sigs.k8s.io/yaml v1.6.0 // indirect diff --git a/go.sum b/go.sum index c610de0434..f4e2831f5b 100644 --- a/go.sum +++ b/go.sum @@ -366,8 +366,8 @@ github.com/Microsoft/cosesign1go v1.7.0 h1:uf/zRnSzfZaCjqgw9e+wwsqbe9J1sLZZEsEjs github.com/Microsoft/cosesign1go v1.7.0/go.mod h1:7x+fdYtZ4ureEgfVtl2K+nY4MMfujMsCIb5kRuncpmg= github.com/Microsoft/didx509go v0.0.3 h1:n/owuFOXVzCEzSyzivMEolKEouBm9G0NrEDgoTekM8A= github.com/Microsoft/didx509go v0.0.3/go.mod h1:wWt+iQsLzn3011+VfESzznLIp/Owhuj7rLF7yLglYbk= -github.com/Microsoft/go-winio v0.6.3-0.20260917205003-526e22f39a0a h1:fAOaVG8riXgBe8ACxoYCTv8191XXOvQ7q5BKfig48i8= -github.com/Microsoft/go-winio v0.6.3-0.20260917205003-526e22f39a0a/go.mod h1:ZWa7ssZJT30CCDGJ7fk/2SBTq9BIQrrVjrcss0UW2s0= +github.com/Microsoft/go-winio v0.6.3 h1:M/52tsoyTfwaxajLnXZm7PqkbMGRH8iSWP+8fcg9MQ4= +github.com/Microsoft/go-winio v0.6.3/go.mod h1:ma0QpxizD4fyyzJ1C7MIblymTD2Nxz5Mho/3CepwIZg= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= @@ -907,8 +907,8 @@ github.com/seccomp/libseccomp-golang v0.11.1 h1:wuk4ZjSx6kyQII4rj6G6fvVzRHQaSiPv github.com/seccomp/libseccomp-golang v0.11.1/go.mod h1:5m1Lk8E9OwgZTTVz4bBOer7JuazaBa+xTkM895tDiWc= github.com/segmentio/asm v1.2.1 h1:DTNbBqs57ioxAD4PrArqftgypG4/qNpXoJx8TVXxPR0= github.com/segmentio/asm v1.2.1/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= -github.com/sirupsen/logrus v1.10.0 h1:T8MxJJXVZkfcC5zSRMRAg2F8+lxjmUCGGWPzFxO+Msc= -github.com/sirupsen/logrus v1.10.0/go.mod h1:FXZFonkDAnFozmO+5hGAFvB0Yg9/j2SIhA/QuIkP180= +github.com/sirupsen/logrus v1.10.2 h1:G2SED73/qrAu6YwbdxOD6peLkCBI3z7L+ykJFTXJBBo= +github.com/sirupsen/logrus v1.10.2/go.mod h1:SLEg8TqYulVKKfIGHldVp2K2aYz2DKSVBq4g/H5bR7Q= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= @@ -1634,8 +1634,8 @@ golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxb golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI= golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY= -golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI= -golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo= +golang.org/x/tools v0.50.0 h1:c2ifzfcuY7L90lZ2aKd8S4K2NpASF08SZx9ZuJkHmSU= +golang.org/x/tools v0.50.0/go.mod h1:7ulVMw3831Mwi5EZD6RomGyffr4VFjuNYXf2BbCEAV0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/vendor/github.com/Microsoft/go-winio/.golangci.yml b/vendor/github.com/Microsoft/go-winio/.golangci.yml index 924b5ce596..07a22649a0 100644 --- a/vendor/github.com/Microsoft/go-winio/.golangci.yml +++ b/vendor/github.com/Microsoft/go-winio/.golangci.yml @@ -1,9 +1,15 @@ +version: "2" +formatters: + enable: + - gofmt # files are gofmt'ed linters: enable: # style - containedctx # struct contains a context - dupl # duplicate code - - errname # erorrs are named correctly + - dupword # duplicate words in comments + - errname # errors are named correctly + - intrange # integer ranges in for loop - nolintlint # "//nolint" directives are properly explained - revive # golint replacement - unconvert # unnecessary conversions @@ -13,139 +19,155 @@ linters: - contextcheck # function uses a non-inherited context - errorlint # errors not wrapped for 1.13 - exhaustive # check exhaustiveness of enum switch statements - - gofmt # files are gofmt'ed + - gocritic # various code quality checks - gosec # security + - mirror # avoid allocations - nilerr # returns nil even with non-nil error - thelper # test helpers without t.Helper() - unparam # unused function params -issues: - exclude-dirs: - - pkg/etw/sample - - exclude-rules: - # err is very often shadowed in nested scopes - - linters: - - govet - text: '^shadow: declaration of "err" shadows declaration' - - # ignore long lines for skip autogen directives - - linters: - - revive - text: "^line-length-limit: " - source: "^//(go:generate|sys) " + exclusions: + paths: + - pkg/etw/sample + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + rules: + # err is very often shadowed in nested scopes + - linters: + - govet + text: '^shadow: declaration of "err" shadows declaration' - #TODO: remove after upgrading to go1.18 - # ignore comment spacing for nolint and sys directives - - linters: - - revive - text: "^comment-spacings: no space between comment delimiter and comment text" - source: "//(cspell:|nolint:|sys |todo)" + # ignore long lines for skip autogen directives + - linters: + - revive + text: "^line-length-limit: " + source: "^//(go:generate|sys) " - # not on go 1.18 yet, so no any - - linters: - - revive - text: "^use-any: since GO 1.18 'interface{}' can be replaced by 'any'" + # ignore comment spacing for sys directives + - linters: + - revive + text: "^comment-spacings: no space between comment delimiter and comment text" + source: "//(cspell:|sys )" - # allow unjustified ignores of error checks in defer statements - - linters: - - nolintlint - text: "^directive `//nolint:errcheck` should provide explanation" - source: '^\s*defer ' + # allow unjustified ignores of error checks in defer statements + - linters: + - nolintlint + text: "^directive `//nolint:errcheck` should provide explanation" + source: '^\s*defer ' - # allow unjustified ignores of error lints for io.EOF - - linters: - - nolintlint - text: "^directive `//nolint:errorlint` should provide explanation" - source: '[=|!]= io.EOF' + # allow unjustified ignores of error lints for io.EOF + - linters: + - nolintlint + text: "^directive `//nolint:errorlint` should provide explanation" + source: '[=|!]= io.EOF' - - linters: - - gosec - text: "^G115: integer overflow conversion" + - linters: + - gosec + text: "^G115: integer overflow conversion" -linters-settings: - exhaustive: - default-signifies-exhaustive: true - govet: - enable-all: true - disable: - # struct order is often for Win32 compat - # also, ignore pointer bytes/GC issues for now until performance becomes an issue - - fieldalignment - nolintlint: - require-explanation: true - require-specific: true - revive: - # revive is more configurable than static check, so likely the preferred alternative to static-check - # (once the perf issue is solved: https://github.com/golangci/golangci-lint/issues/2997) - enable-all-rules: - true + settings: + exhaustive: + default-signifies-exhaustive: true + gocritic: + disable-all: true + enabled-checks: + - nilValReturn + - sprintfQuotedString + govet: + enable-all: true + disable: + # struct order is often for Win32 compat + # also, ignore pointer bytes/GC issues for now until performance becomes an issue + - fieldalignment + nolintlint: + require-explanation: true + require-specific: true + revive: + # revive is more configurable than static check, so likely the preferred alternative to static-check + # (once the perf issue is solved: https://github.com/golangci/golangci-lint/issues/2997) + enable-all-rules: + true # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md - rules: - # rules with required arguments - - name: argument-limit - disabled: true - - name: banned-characters - disabled: true - - name: cognitive-complexity - disabled: true - - name: cyclomatic - disabled: true - - name: file-header - disabled: true - - name: function-length - disabled: true - - name: function-result-limit - disabled: true - - name: max-public-structs - disabled: true - # geneally annoying rules - - name: add-constant # complains about any and all strings and integers - disabled: true - - name: confusing-naming # we frequently use "Foo()" and "foo()" together - disabled: true - - name: flag-parameter # excessive, and a common idiom we use - disabled: true - - name: unhandled-error # warns over common fmt.Print* and io.Close; rely on errcheck instead - disabled: true - # general config - - name: line-length-limit - arguments: - - 140 - - name: var-naming - arguments: - - [] - - - CID - - CRI - - CTRD - - DACL - - DLL - - DOS - - ETW - - FSCTL - - GCS - - GMSA - - HCS - - HV - - IO - - LCOW - - LDAP - - LPAC - - LTSC - - MMIO - - NT - - OCI - - PMEM - - PWSH - - RX - - SACl - - SID - - SMB - - TX - - VHD - - VHDX - - VMID - - VPCI - - WCOW - - WIM + rules: + # rules with required arguments + - name: argument-limit + disabled: true + - name: banned-characters + disabled: true + - name: cognitive-complexity + disabled: true + - name: cyclomatic + disabled: true + # covered by "exhaustive" linter + - name: enforce-switch-style + disabled: true + - name: file-header + disabled: true + - name: function-length + disabled: true + - name: function-result-limit + disabled: true + - name: max-public-structs + disabled: true + # generally annoying rules + - name: add-constant # complains about any and all strings and integers + disabled: true + - name: confusing-naming # we frequently use "Foo()" and "foo()" together + disabled: true + - name: flag-parameter # excessive, and a common idiom we use + disabled: true + - name: multiline-if-init # too opinionated; see https://github.com/microsoft/go-winio/pull/325#issuecomment-5822487436 + disabled: true + - name: unhandled-error # warns over common fmt.Print* and io.Close; rely on errcheck instead + disabled: true + # general config + - name: line-length-limit + arguments: + - 140 + - name: var-naming + arguments: + - [] + - - CID + - CRI + - CTRD + - DACL + - DLL + - DOS + - ETW + - FSCTL + - GCS + - GMSA + - HCS + - HV + - IO + - LCOW + - LDAP + - LPAC + - LTSC + - MMIO + - NT + - OCI + - PMEM + - PWSH + - RX + - SACl + - SID + - SMB + - TX + - VHD + - VHDX + - VMID + - VPCI + - WCOW + - WIM + staticcheck: + # Enable all options, with some exceptions. + # For defaults, see https://golangci-lint.run/usage/linters/#staticcheck + checks: + - all + - -QF1008 # Omit embedded fields from selector expression; https://staticcheck.dev/docs/checks/#QF1008 + - -ST1003 # Poorly chosen identifier; https://staticcheck.dev/docs/checks/#ST1003 diff --git a/vendor/github.com/Microsoft/go-winio/backup.go b/vendor/github.com/Microsoft/go-winio/backup.go index 7c2e4ba233..37055fa6a9 100644 --- a/vendor/github.com/Microsoft/go-winio/backup.go +++ b/vendor/github.com/Microsoft/go-winio/backup.go @@ -35,7 +35,7 @@ const ( StreamSparseAttributes = uint32(8) ) -//nolint:revive // var-naming: ALL_CAPS +//nolint:revive,nolintlint // var-naming: ALL_CAPS const ( WRITE_DAC = windows.WRITE_DAC WRITE_OWNER = windows.WRITE_OWNER diff --git a/vendor/github.com/Microsoft/go-winio/backuptar/strconv.go b/vendor/github.com/Microsoft/go-winio/backuptar/strconv.go index 455fd798eb..67389fa337 100644 --- a/vendor/github.com/Microsoft/go-winio/backuptar/strconv.go +++ b/vendor/github.com/Microsoft/go-winio/backuptar/strconv.go @@ -22,8 +22,8 @@ func parsePAXTime(s string) (time.Time, error) { // Split string into seconds and sub-seconds parts. ss, sn := s, "" - if pos := strings.IndexByte(s, '.'); pos >= 0 { - ss, sn = s[:pos], s[pos+1:] + if before, after, ok := strings.Cut(s, "."); ok { + ss, sn = before, after } // Parse the seconds. diff --git a/vendor/github.com/Microsoft/go-winio/backuptar/tar.go b/vendor/github.com/Microsoft/go-winio/backuptar/tar.go index 3378d87e63..43aebb0f93 100644 --- a/vendor/github.com/Microsoft/go-winio/backuptar/tar.go +++ b/vendor/github.com/Microsoft/go-winio/backuptar/tar.go @@ -16,7 +16,6 @@ import ( "golang.org/x/sys/windows" ) -//nolint:deadcode,varcheck // keep unused constants for potential future use const ( cISUID = 0004000 // Set uid cISGID = 0002000 // Set gid @@ -211,7 +210,7 @@ func WriteTarFileFromBackupStream(t *tar.Writer, r io.Reader, name string, size if err != nil { return err } - switch bhdr.Id { + switch bhdr.Id { //nolint:revive // ignore "switch" with identical branches. case winio.BackupData: hdr.Mode |= cISREG if !readTwice { @@ -339,7 +338,7 @@ func WriteTarFileFromBackupStream(t *tar.Writer, r io.Reader, name string, size if err != nil { return err } - switch bhdr.Id { + switch bhdr.Id { //nolint:revive // ignore "switch" with identical branches. case winio.BackupAlternateData: if (bhdr.Attributes & winio.StreamSparseAttributes) != 0 { // Unsupported for now, since the size of the alternate stream is not present diff --git a/vendor/github.com/Microsoft/go-winio/ea.go b/vendor/github.com/Microsoft/go-winio/ea.go index e104dbdfdf..00a4bd96c8 100644 --- a/vendor/github.com/Microsoft/go-winio/ea.go +++ b/vendor/github.com/Microsoft/go-winio/ea.go @@ -95,7 +95,7 @@ func writeEa(buf *bytes.Buffer, ea *ExtendedAttribute, last bool) error { return err } - _, err = buf.Write([]byte(ea.Name)) + _, err = buf.WriteString(ea.Name) if err != nil { return err } diff --git a/vendor/github.com/Microsoft/go-winio/file.go b/vendor/github.com/Microsoft/go-winio/file.go index f38213763e..449bb3bd1b 100644 --- a/vendor/github.com/Microsoft/go-winio/file.go +++ b/vendor/github.com/Microsoft/go-winio/file.go @@ -3,8 +3,9 @@ package winio import ( - "errors" + "context" "io" + "os" "runtime" "sync" "sync/atomic" @@ -20,16 +21,33 @@ import ( //sys setFileCompletionNotificationModes(h windows.Handle, flags uint8) (err error) = SetFileCompletionNotificationModes //sys wsaGetOverlappedResult(h windows.Handle, o *windows.Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) = ws2_32.WSAGetOverlappedResult -var ( - ErrFileClosed = errors.New("file has already been closed") - ErrTimeout = &timeoutError{} -) - +// ErrFileClosed is returned when an operation is performed on a closed file. +// +// Deprecated: use [os.ErrClosed] instead. +var ErrFileClosed = os.ErrClosed + +// ErrTimeout is returned when an I/O operation exceeds its deadline. +// +// It matches both [context.DeadlineExceeded] and [os.ErrDeadlineExceeded] +// with [errors.Is]. +var ErrTimeout error = &timeoutError{} + +// timeoutError preserves the historical "i/o timeout" error while matching +// both context.DeadlineExceeded and os.ErrDeadlineExceeded through errors.Is. +// This mirrors the behavior of net.errTimeout: +// https://github.com/golang/go/blob/go1.27.1/src/net/net.go +// +// TODO: consider replacing ErrTimeout with os.ErrDeadlineExceeded if os.ErrDeadlineExceeded is changed to match context.DeadlineExceeded. type timeoutError struct{} func (*timeoutError) Error() string { return "i/o timeout" } func (*timeoutError) Timeout() bool { return true } func (*timeoutError) Temporary() bool { return true } +func (*timeoutError) Unwrap() error { return os.ErrDeadlineExceeded } + +func (*timeoutError) Is(err error) bool { + return err == context.DeadlineExceeded +} type timeoutChan chan struct{} @@ -143,7 +161,7 @@ func (f *win32File) prepareIO() (*ioOperation, error) { f.wgLock.RLock() if f.closing.Load() { f.wgLock.RUnlock() - return nil, ErrFileClosed + return nil, os.ErrClosed } f.wg.Add(1) f.wgLock.RUnlock() @@ -192,7 +210,7 @@ func (f *win32File) asyncIO(c *ioOperation, d *deadlineHandler, bytes uint32, er err = r.err if err == windows.ERROR_OPERATION_ABORTED { //nolint:errorlint // err is Errno if f.closing.Load() { - err = ErrFileClosed + err = os.ErrClosed } } else if err != nil && f.socket { // err is from Win32. Query the overlapped structure to get the winsock error. @@ -234,12 +252,17 @@ func (f *win32File) Read(b []byte) (int, error) { runtime.KeepAlive(b) // Handle EOF conditions. - if err == nil && n == 0 && len(b) != 0 { - return 0, io.EOF - } else if err == windows.ERROR_BROKEN_PIPE { //nolint:errorlint // err is Errno + switch err { + case windows.ERROR_BROKEN_PIPE: //nolint:errorlint // err is Errno return 0, io.EOF + case nil: + if n == 0 && len(b) != 0 { + return 0, io.EOF + } + return n, nil + default: + return n, err } - return n, err } // Write writes to a file handle. diff --git a/vendor/github.com/Microsoft/go-winio/hvsock.go b/vendor/github.com/Microsoft/go-winio/hvsock.go index d4960f5b0a..df2008f6f6 100644 --- a/vendor/github.com/Microsoft/go-winio/hvsock.go +++ b/vendor/github.com/Microsoft/go-winio/hvsock.go @@ -441,7 +441,7 @@ func canRedial(err error) bool { func (conn *HvsockConn) opErr(op string, err error) error { // translate from "file closed" to "socket closed" - if errors.Is(err, ErrFileClosed) { + if errors.Is(err, os.ErrClosed) { err = socket.ErrSocketClosed } return &net.OpError{Op: op, Net: "hvsock", Source: &conn.local, Addr: &conn.remote, Err: err} diff --git a/vendor/github.com/Microsoft/go-winio/internal/fs/fs.go b/vendor/github.com/Microsoft/go-winio/internal/fs/fs.go index 0cd9621df7..f3bc2aeb8a 100644 --- a/vendor/github.com/Microsoft/go-winio/internal/fs/fs.go +++ b/vendor/github.com/Microsoft/go-winio/internal/fs/fs.go @@ -243,7 +243,7 @@ const ( // https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfinalpathnamebyhandlew func GetFinalPathNameByHandle(h windows.Handle, flags GetFinalPathFlag) (string, error) { b := stringbuffer.NewWString() - //TODO: can loop infinitely if Win32 keeps returning the same (or a larger) n? + // TODO: can loop infinitely if Win32 keeps returning the same (or a larger) n? for { n, err := windows.GetFinalPathNameByHandle(h, b.Pointer(), b.Cap(), uint32(flags)) if err != nil { diff --git a/vendor/github.com/Microsoft/go-winio/internal/fs/zsyscall_windows.go b/vendor/github.com/Microsoft/go-winio/internal/fs/zsyscall_windows.go index a94e234c70..f7b27abfcc 100644 --- a/vendor/github.com/Microsoft/go-winio/internal/fs/zsyscall_windows.go +++ b/vendor/github.com/Microsoft/go-winio/internal/fs/zsyscall_windows.go @@ -15,12 +15,8 @@ var _ unsafe.Pointer // Do the interface allocations only once for common // Errno values. -const ( - errnoERROR_IO_PENDING = 997 -) - var ( - errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) + errERROR_IO_PENDING error = windows.ERROR_IO_PENDING errERROR_EINVAL error = syscall.EINVAL ) @@ -30,7 +26,7 @@ func errnoErr(e syscall.Errno) error { switch e { case 0: return errERROR_EINVAL - case errnoERROR_IO_PENDING: + case windows.ERROR_IO_PENDING: return errERROR_IO_PENDING } return e diff --git a/vendor/github.com/Microsoft/go-winio/internal/socket/zsyscall_windows.go b/vendor/github.com/Microsoft/go-winio/internal/socket/zsyscall_windows.go index e1504126aa..06e84da653 100644 --- a/vendor/github.com/Microsoft/go-winio/internal/socket/zsyscall_windows.go +++ b/vendor/github.com/Microsoft/go-winio/internal/socket/zsyscall_windows.go @@ -15,12 +15,8 @@ var _ unsafe.Pointer // Do the interface allocations only once for common // Errno values. -const ( - errnoERROR_IO_PENDING = 997 -) - var ( - errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) + errERROR_IO_PENDING error = windows.ERROR_IO_PENDING errERROR_EINVAL error = syscall.EINVAL ) @@ -30,7 +26,7 @@ func errnoErr(e syscall.Errno) error { switch e { case 0: return errERROR_EINVAL - case errnoERROR_IO_PENDING: + case windows.ERROR_IO_PENDING: return errERROR_IO_PENDING } return e diff --git a/vendor/github.com/Microsoft/go-winio/internal/stringbuffer/wstring.go b/vendor/github.com/Microsoft/go-winio/internal/stringbuffer/wstring.go index 42ebc019fc..2295408733 100644 --- a/vendor/github.com/Microsoft/go-winio/internal/stringbuffer/wstring.go +++ b/vendor/github.com/Microsoft/go-winio/internal/stringbuffer/wstring.go @@ -7,7 +7,7 @@ import ( // TODO: worth exporting and using in mkwinsyscall? -// Uint16BufferSize is the buffer size in the pool, chosen somewhat arbitrarily to accommodate +// MinWStringCap is the buffer size in the pool, chosen somewhat arbitrarily to accommodate // large path strings: // MAX_PATH (260) + size of volume GUID prefix (49) + null terminator = 310. const MinWStringCap = 310 @@ -16,7 +16,7 @@ const MinWStringCap = 310 // is copied to heap and then referenced via pointer in the interface header that sync.Pool // stores. var pathPool = sync.Pool{ // if go1.18+ adds Pool[T], use that to store []uint16 directly - New: func() interface{} { + New: func() any { b := make([]uint16, MinWStringCap) return &b }, diff --git a/vendor/github.com/Microsoft/go-winio/pipe.go b/vendor/github.com/Microsoft/go-winio/pipe.go index 58c68e9522..850fe3e53a 100644 --- a/vendor/github.com/Microsoft/go-winio/pipe.go +++ b/vendor/github.com/Microsoft/go-winio/pipe.go @@ -10,6 +10,7 @@ import ( "net" "os" "runtime" + "sync" "time" "unsafe" @@ -101,12 +102,10 @@ func (status ntStatus) Err() error { return rtlNtStatusToDosError(status) } -var ( - // ErrPipeListenerClosed is returned for pipe operations on listeners that have been closed. - ErrPipeListenerClosed = net.ErrClosed - - errPipeWriteClosed = errors.New("pipe has been closed for write") -) +// ErrPipeListenerClosed is returned for pipe operations on listeners that have been closed. +// +// Deprecated: use [net.ErrClosed] instead. +var ErrPipeListenerClosed = net.ErrClosed type win32Pipe struct { *win32File @@ -143,9 +142,10 @@ func (f *win32Pipe) Disconnect() error { } // CloseWrite closes the write side of a message pipe in byte mode. +// It returns [io.ErrClosedPipe] if the write side is already closed. func (f *win32MessageBytePipe) CloseWrite() error { if f.writeClosed { - return errPipeWriteClosed + return io.ErrClosedPipe } err := f.win32File.Flush() if err != nil { @@ -160,10 +160,10 @@ func (f *win32MessageBytePipe) CloseWrite() error { } // Write writes bytes to a message pipe in byte mode. Zero-byte writes are ignored, since -// they are used to implement CloseWrite(). +// they are used to implement CloseWrite. It returns [io.ErrClosedPipe] if the write side is closed. func (f *win32MessageBytePipe) Write(b []byte) (int, error) { if f.writeClosed { - return 0, errPipeWriteClosed + return 0, io.ErrClosedPipe } if len(b) == 0 { return 0, nil @@ -178,14 +178,15 @@ func (f *win32MessageBytePipe) Read(b []byte) (int, error) { return 0, io.EOF } n, err := f.win32File.Read(b) - if err == io.EOF { //nolint:errorlint + switch err { + case io.EOF: //nolint:errorlint // error is not wrapped. // If this was the result of a zero-byte read, then // it is possible that the read was due to a zero-size // message. Since we are simulating CloseWrite with a // zero-byte message, ensure that all future Read() calls // also return EOF. f.readEOF = true - } else if err == windows.ERROR_MORE_DATA { //nolint:errorlint // err is Errno + case windows.ERROR_MORE_DATA: // ERROR_MORE_DATA indicates that the pipe's read mode is message mode // and the message still has more bytes. Treat this as a success, since // this package presents all named pipes as byte streams. @@ -315,8 +316,9 @@ type win32PipeListener struct { path string config PipeConfig acceptCh chan (chan acceptResponse) - closeCh chan int - doneCh chan int + closeOnce sync.Once + closeCh chan struct{} // closed (never sent on) to broadcast listener shutdown + doneCh chan struct{} } func makeServerPipeHandle(path string, sd []byte, c *PipeConfig, first bool) (windows.Handle, error) { @@ -343,7 +345,7 @@ func makeServerPipeHandle(path string, sd []byte, c *PipeConfig, first bool) (wi // The security descriptor is only needed for the first pipe. if first { if sd != nil { - //todo: does `sdb` need to be allocated on the heap, or can go allocate it? + // todo: does `sdb` need to be allocated on the heap, or can go allocate it? l := uint32(len(sd)) sdb, err := windows.LocalAlloc(0, l) if err != nil { @@ -444,13 +446,14 @@ func (l *win32PipeListener) makeConnectedServerPipe() (*win32File, error) { p = nil } case <-l.closeCh: - // Abort the connect request by closing the handle. - p.Close() + // Abort the connect request by closing the handle. Listener closure is + // authoritative: ConnectNamedPipe may race the handle close and report a + // connection or error (e.g. ERROR_NO_DATA) instead of ErrFileClosed, and + // that result must not be surfaced or cause listenerRoutine to retry. + _ = p.Close() p = nil - err = <-ch - if err == nil || err == ErrFileClosed { //nolint:errorlint // err is Errno - err = ErrPipeListenerClosed - } + <-ch + err = net.ErrClosed } return p, err } @@ -475,7 +478,7 @@ func (l *win32PipeListener) listenerRoutine() { } } responseCh <- acceptResponse{p, err} - closed = err == ErrPipeListenerClosed //nolint:errorlint // err is Errno + closed = err == net.ErrClosed //nolint:errorlint // err is Errno } } windows.Close(l.firstHandle) @@ -529,8 +532,8 @@ func ListenPipe(path string, c *PipeConfig) (net.Listener, error) { path: path, config: *c, acceptCh: make(chan (chan acceptResponse)), - closeCh: make(chan int), - doneCh: make(chan int), + closeCh: make(chan struct{}), + doneCh: make(chan struct{}), } go l.listenerRoutine() return l, nil @@ -567,16 +570,15 @@ func (l *win32PipeListener) Accept() (net.Conn, error) { } return &win32Pipe{win32File: response.f, path: l.path}, nil case <-l.doneCh: - return nil, ErrPipeListenerClosed + return nil, net.ErrClosed } } func (l *win32PipeListener) Close() error { - select { - case l.closeCh <- 1: - <-l.doneCh - case <-l.doneCh: - } + l.closeOnce.Do(func() { + close(l.closeCh) + }) + <-l.doneCh return nil } diff --git a/vendor/github.com/Microsoft/go-winio/pkg/bindfilter/bind_filter.go b/vendor/github.com/Microsoft/go-winio/pkg/bindfilter/bind_filter.go index f3e9d7b29e..346673ba82 100644 --- a/vendor/github.com/Microsoft/go-winio/pkg/bindfilter/bind_filter.go +++ b/vendor/github.com/Microsoft/go-winio/pkg/bindfilter/bind_filter.go @@ -23,7 +23,7 @@ import ( // BfSetupFilter flags. See: // https://github.com/microsoft/BuildXL/blob/a6dce509f0d4f774255e5fbfb75fa6d5290ed163/Public/Src/Utilities/Native/Processes/Windows/NativeContainerUtilities.cs#L193-L240 // -//nolint:revive // var-naming: ALL_CAPS +//nolint:revive,nolintlint // var-naming: ALL_CAPS const ( BINDFLT_FLAG_READ_ONLY_MAPPING uint32 = 0x00000001 // Tells bindflt to fail mapping with STATUS_INVALID_PARAMETER if a mapping produces @@ -31,7 +31,7 @@ const ( BINDFLT_FLAG_NO_MULTIPLE_TARGETS uint32 = 0x00000040 ) -//nolint:revive // var-naming: ALL_CAPS +//nolint:revive,nolintlint // var-naming: ALL_CAPS const ( BINDFLT_GET_MAPPINGS_FLAG_VOLUME uint32 = 0x00000001 BINDFLT_GET_MAPPINGS_FLAG_SILO uint32 = 0x00000002 @@ -131,7 +131,7 @@ func GetBindMappings(volumePath string) ([]BindMapping, error) { mappings := unsafe.Slice(mappingsPointer, header.MappingCount) mappingEntries := make([]BindMapping, header.MappingCount) - for i := 0; i < int(header.MappingCount); i++ { + for i := range int(header.MappingCount) { bindMapping, err := getBindMappingFromBuffer(result, mappings[i]) if err != nil { return nil, fmt.Errorf("fetching bind mappings: %w", err) @@ -188,7 +188,7 @@ func getTargetsFromBuffer(buffer []byte, offset, count int) ([]string, error) { } targets := make([]string, count) - for i := 0; i < count; i++ { + for i := range count { entryBuf := buffer[offset+i*8 : offset+i*8+8] tgt := *(*mappingTargetEntry)(unsafe.Pointer(&entryBuf[0])) if len(buffer) < int(tgt.TargetRootOffset)+int(tgt.TargetRootLength) { diff --git a/vendor/github.com/Microsoft/go-winio/pkg/bindfilter/zsyscall_windows.go b/vendor/github.com/Microsoft/go-winio/pkg/bindfilter/zsyscall_windows.go index 1da9b3f3b4..22ad45a40b 100644 --- a/vendor/github.com/Microsoft/go-winio/pkg/bindfilter/zsyscall_windows.go +++ b/vendor/github.com/Microsoft/go-winio/pkg/bindfilter/zsyscall_windows.go @@ -15,12 +15,8 @@ var _ unsafe.Pointer // Do the interface allocations only once for common // Errno values. -const ( - errnoERROR_IO_PENDING = 997 -) - var ( - errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) + errERROR_IO_PENDING error = windows.ERROR_IO_PENDING errERROR_EINVAL error = syscall.EINVAL ) @@ -30,7 +26,7 @@ func errnoErr(e syscall.Errno) error { switch e { case 0: return errERROR_EINVAL - case errnoERROR_IO_PENDING: + case windows.ERROR_IO_PENDING: return errERROR_IO_PENDING } return e diff --git a/vendor/github.com/Microsoft/go-winio/pkg/etw/eventdescriptor.go b/vendor/github.com/Microsoft/go-winio/pkg/etw/eventdescriptor.go index aac68d7e95..6151dafcfc 100644 --- a/vendor/github.com/Microsoft/go-winio/pkg/etw/eventdescriptor.go +++ b/vendor/github.com/Microsoft/go-winio/pkg/etw/eventdescriptor.go @@ -23,7 +23,7 @@ var _ fmt.Stringer = Level(0) // Predefined ETW log levels from winmeta.xml in the Windows SDK. // -//go:generate go run golang.org/x/tools/cmd/stringer -type=Level -trimprefix=Level +//go:generate go tool stringer -type=Level -trimprefix=Level const ( LevelAlways Level = iota LevelCritical @@ -40,7 +40,7 @@ var _ fmt.Stringer = Opcode(0) // Predefined ETW opcodes from winmeta.xml in the Windows SDK. // -//go:generate go run golang.org/x/tools/cmd/stringer -type=Opcode -trimprefix=Opcode +//go:generate go tool stringer -type=Opcode -trimprefix=Opcode const ( // OpcodeInfo indicates an informational event. OpcodeInfo Opcode = iota @@ -55,6 +55,8 @@ const ( ) // eventDescriptor represents various metadata for an ETW event. +// +//nolint:unused,nolintlint // only used on Windows. type eventDescriptor struct { id uint16 version uint8 @@ -67,6 +69,8 @@ type eventDescriptor struct { // newEventDescriptor returns an EventDescriptor initialized for use with // TraceLogging. +// +//nolint:unused,nolintlint // only used on Windows. func newEventDescriptor() *eventDescriptor { // Standard TraceLogging events default to the TraceLogging channel, and // verbose level. diff --git a/vendor/github.com/Microsoft/go-winio/pkg/etw/eventmetadata.go b/vendor/github.com/Microsoft/go-winio/pkg/etw/eventmetadata.go index a2e151a502..691b6239bf 100644 --- a/vendor/github.com/Microsoft/go-winio/pkg/etw/eventmetadata.go +++ b/vendor/github.com/Microsoft/go-winio/pkg/etw/eventmetadata.go @@ -12,8 +12,6 @@ type inType byte // Various inType definitions for TraceLogging. These must match the definitions // found in TraceLoggingProvider.h in the Windows SDK. -// -//nolint:deadcode,varcheck // keep unused constants for potential future use const ( inTypeNull inType = iota inTypeUnicodeString @@ -51,8 +49,6 @@ type outType byte // Various outType definitions for TraceLogging. These must match the // definitions found in TraceLoggingProvider.h in the Windows SDK. -// -//nolint:deadcode,varcheck // keep unused constants for potential future use const ( // outTypeDefault indicates that the default formatting for the inType will // be used by the event decoder. diff --git a/vendor/github.com/Microsoft/go-winio/pkg/etw/fieldopt.go b/vendor/github.com/Microsoft/go-winio/pkg/etw/fieldopt.go index 2798e979ff..0380b7e5ea 100644 --- a/vendor/github.com/Microsoft/go-winio/pkg/etw/fieldopt.go +++ b/vendor/github.com/Microsoft/go-winio/pkg/etw/fieldopt.go @@ -411,7 +411,7 @@ func Time(name string, value time.Time) FieldOpt { // type. The intent of this is to make it easier to see which types are not // supported in traces, so we can evaluate adding support for more types in the // future. -func SmartField(name string, v interface{}) FieldOpt { +func SmartField(name string, v any) FieldOpt { switch v := v.(type) { case bool: return BoolField(name, v) @@ -511,7 +511,7 @@ func SmartField(name string, v interface{}) FieldOpt { return SmartField(name, rv.String()) case reflect.Struct: fields := make([]FieldOpt, 0, rv.NumField()) - for i := 0; i < rv.NumField(); i++ { + for i := range rv.NumField() { field := rv.Field(i) if field.CanInterface() { fields = append(fields, SmartField(name, field.Interface())) @@ -519,7 +519,7 @@ func SmartField(name string, v interface{}) FieldOpt { } return Struct(name, fields...) case reflect.Array, reflect.Chan, reflect.Complex128, reflect.Complex64, - reflect.Func, reflect.Interface, reflect.Invalid, reflect.Map, reflect.Ptr, + reflect.Func, reflect.Interface, reflect.Invalid, reflect.Map, reflect.Pointer, reflect.Slice, reflect.UnsafePointer: } } diff --git a/vendor/github.com/Microsoft/go-winio/pkg/etw/level_string.go b/vendor/github.com/Microsoft/go-winio/pkg/etw/level_string.go index c606878eaa..662708ca5f 100644 --- a/vendor/github.com/Microsoft/go-winio/pkg/etw/level_string.go +++ b/vendor/github.com/Microsoft/go-winio/pkg/etw/level_string.go @@ -21,8 +21,9 @@ const _Level_name = "AlwaysCriticalErrorWarningInfoVerbose" var _Level_index = [...]uint8{0, 6, 14, 19, 26, 30, 37} func (i Level) String() string { - if i >= Level(len(_Level_index)-1) { + idx := int(i) - 0 + if i < 0 || idx >= len(_Level_index)-1 { return "Level(" + strconv.FormatInt(int64(i), 10) + ")" } - return _Level_name[_Level_index[i]:_Level_index[i+1]] + return _Level_name[_Level_index[idx]:_Level_index[idx+1]] } diff --git a/vendor/github.com/Microsoft/go-winio/pkg/etw/opcode_string.go b/vendor/github.com/Microsoft/go-winio/pkg/etw/opcode_string.go index 8d90a43d88..751eb48917 100644 --- a/vendor/github.com/Microsoft/go-winio/pkg/etw/opcode_string.go +++ b/vendor/github.com/Microsoft/go-winio/pkg/etw/opcode_string.go @@ -20,8 +20,9 @@ const _Opcode_name = "InfoStartStopDCStartDCStop" var _Opcode_index = [...]uint8{0, 4, 9, 13, 20, 26} func (i Opcode) String() string { - if i >= Opcode(len(_Opcode_index)-1) { + idx := int(i) - 0 + if i < 0 || idx >= len(_Opcode_index)-1 { return "Opcode(" + strconv.FormatInt(int64(i), 10) + ")" } - return _Opcode_name[_Opcode_index[i]:_Opcode_index[i+1]] + return _Opcode_name[_Opcode_index[idx]:_Opcode_index[idx+1]] } diff --git a/vendor/github.com/Microsoft/go-winio/pkg/etw/provider.go b/vendor/github.com/Microsoft/go-winio/pkg/etw/provider.go index 089808a929..29cdddfa22 100644 --- a/vendor/github.com/Microsoft/go-winio/pkg/etw/provider.go +++ b/vendor/github.com/Microsoft/go-winio/pkg/etw/provider.go @@ -54,7 +54,6 @@ const ( type eventInfoClass uint32 -//nolint:deadcode,varcheck // keep unused constants for potential future use const ( eventInfoClassProviderBinaryTrackInfo eventInfoClass = iota eventInfoClassProviderSetReserved1 diff --git a/vendor/github.com/Microsoft/go-winio/pkg/etw/providerglobal.go b/vendor/github.com/Microsoft/go-winio/pkg/etw/providerglobal.go index 831697a659..bcb0ad2500 100644 --- a/vendor/github.com/Microsoft/go-winio/pkg/etw/providerglobal.go +++ b/vendor/github.com/Microsoft/go-winio/pkg/etw/providerglobal.go @@ -49,7 +49,7 @@ func (p *providerMap) getProvider(index uint) *Provider { return p.m[index] } -//todo: combine these into struct, so that "globalProviderCallback" is guaranteed to be initialized through method access +// todo: combine these into struct, so that "globalProviderCallback" is guaranteed to be initialized through method access var providerCallbackOnce sync.Once var globalProviderCallback uintptr diff --git a/vendor/github.com/Microsoft/go-winio/pkg/etw/zsyscall_windows.go b/vendor/github.com/Microsoft/go-winio/pkg/etw/zsyscall_windows.go index 752fe6f6c8..11befc7420 100644 --- a/vendor/github.com/Microsoft/go-winio/pkg/etw/zsyscall_windows.go +++ b/vendor/github.com/Microsoft/go-winio/pkg/etw/zsyscall_windows.go @@ -15,12 +15,8 @@ var _ unsafe.Pointer // Do the interface allocations only once for common // Errno values. -const ( - errnoERROR_IO_PENDING = 997 -) - var ( - errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) + errERROR_IO_PENDING error = windows.ERROR_IO_PENDING errERROR_EINVAL error = syscall.EINVAL ) @@ -30,7 +26,7 @@ func errnoErr(e syscall.Errno) error { switch e { case 0: return errERROR_EINVAL - case errnoERROR_IO_PENDING: + case windows.ERROR_IO_PENDING: return errERROR_IO_PENDING } return e diff --git a/vendor/github.com/Microsoft/go-winio/pkg/etwlogrus/hook.go b/vendor/github.com/Microsoft/go-winio/pkg/etwlogrus/hook.go index 71f658ed99..fe243c68ad 100644 --- a/vendor/github.com/Microsoft/go-winio/pkg/etwlogrus/hook.go +++ b/vendor/github.com/Microsoft/go-winio/pkg/etwlogrus/hook.go @@ -4,7 +4,7 @@ package etwlogrus import ( "errors" - "sort" + "slices" "github.com/sirupsen/logrus" @@ -123,7 +123,7 @@ func (h *Hook) Fire(e *logrus.Entry) error { names = append(names, k) } } - sort.Strings(names) + slices.Sort(names) // Reserve extra space for the message and time fields. fields := make([]etw.FieldOpt, 0, len(e.Data)+2) diff --git a/vendor/github.com/Microsoft/go-winio/pkg/guid/guid.go b/vendor/github.com/Microsoft/go-winio/pkg/guid/guid.go index 48ce4e9243..fa1bde3a90 100644 --- a/vendor/github.com/Microsoft/go-winio/pkg/guid/guid.go +++ b/vendor/github.com/Microsoft/go-winio/pkg/guid/guid.go @@ -14,7 +14,7 @@ import ( "strconv" ) -//go:generate go run golang.org/x/tools/cmd/stringer -type=Variant -trimprefix=Variant -linecomment +//go:generate go tool stringer -type=Variant -trimprefix=Variant -linecomment // Variant specifies which GUID variant (or "type") of the GUID. It determines // how the entirety of the rest of the GUID is interpreted. diff --git a/vendor/github.com/Microsoft/go-winio/pkg/guid/variant_string.go b/vendor/github.com/Microsoft/go-winio/pkg/guid/variant_string.go index 4076d3132f..76e387d111 100644 --- a/vendor/github.com/Microsoft/go-winio/pkg/guid/variant_string.go +++ b/vendor/github.com/Microsoft/go-winio/pkg/guid/variant_string.go @@ -20,8 +20,9 @@ const _Variant_name = "UnknownNCSRFC 4122MicrosoftFuture" var _Variant_index = [...]uint8{0, 7, 10, 18, 27, 33} func (i Variant) String() string { - if i >= Variant(len(_Variant_index)-1) { + idx := int(i) - 0 + if i < 0 || idx >= len(_Variant_index)-1 { return "Variant(" + strconv.FormatInt(int64(i), 10) + ")" } - return _Variant_name[_Variant_index[i]:_Variant_index[i+1]] + return _Variant_name[_Variant_index[idx]:_Variant_index[idx+1]] } diff --git a/vendor/github.com/Microsoft/go-winio/pkg/process/zsyscall_windows.go b/vendor/github.com/Microsoft/go-winio/pkg/process/zsyscall_windows.go index 8cfb156e16..610a8c9ac1 100644 --- a/vendor/github.com/Microsoft/go-winio/pkg/process/zsyscall_windows.go +++ b/vendor/github.com/Microsoft/go-winio/pkg/process/zsyscall_windows.go @@ -15,12 +15,8 @@ var _ unsafe.Pointer // Do the interface allocations only once for common // Errno values. -const ( - errnoERROR_IO_PENDING = 997 -) - var ( - errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) + errERROR_IO_PENDING error = windows.ERROR_IO_PENDING errERROR_EINVAL error = syscall.EINVAL ) @@ -30,7 +26,7 @@ func errnoErr(e syscall.Errno) error { switch e { case 0: return errERROR_EINVAL - case errnoERROR_IO_PENDING: + case windows.ERROR_IO_PENDING: return errERROR_IO_PENDING } return e diff --git a/vendor/github.com/Microsoft/go-winio/tools/mkwinsyscall/mkwinsyscall.go b/vendor/github.com/Microsoft/go-winio/tools/mkwinsyscall/mkwinsyscall.go index 09a7364b03..637189815f 100644 --- a/vendor/github.com/Microsoft/go-winio/tools/mkwinsyscall/mkwinsyscall.go +++ b/vendor/github.com/Microsoft/go-winio/tools/mkwinsyscall/mkwinsyscall.go @@ -18,10 +18,12 @@ import ( "io" "log" "os" + "os/exec" "path/filepath" "runtime" "sort" "strings" + "sync" "text/template" "golang.org/x/sys/windows" @@ -163,8 +165,8 @@ func (p *Param) TmpVarCode() string { // TmpVarReadbackCode returns source code for reading back the temp variable into the original variable. func (p *Param) TmpVarReadbackCode() string { - switch { - case p.Type == tBoolPtr: + switch p.Type { + case tBoolPtr: return fmt.Sprintf("*%s = %s != 0", p.Name, p.tmpVar()) default: return "" @@ -301,7 +303,7 @@ func (r *Rets) useLongHandleErrorCode(retvar string) string { }` cond := retvar + " == 0" if r.FailCond != "" { - cond = strings.Replace(r.FailCond, "failretval", retvar, 1) + cond = strings.ReplaceAll(r.FailCond, "failretval", retvar) } return fmt.Sprintf(code, cond) } @@ -706,7 +708,7 @@ func (src *Source) ParseFile(path string) error { if err == nil { defer file.Close() return src.parseFile(file) - } else if !(errors.Is(err, os.ErrNotExist) || errors.Is(err, windows.ERROR_INVALID_NAME)) { + } else if !errors.Is(err, os.ErrNotExist) && !errors.Is(err, windows.ERROR_INVALID_NAME) { return err } @@ -741,7 +743,7 @@ func (src *Source) parseFile(file *os.File) error { continue } t = t[5:] - if !(t[0] == ' ' || t[0] == '\t') { + if t[0] != ' ' && t[0] != '\t' { continue } f, err := newFn(t[1:]) @@ -779,6 +781,14 @@ func (src *Source) parseFile(file *os.File) error { return nil } +var currentGOROOT = sync.OnceValues(func() (string, error) { + out, err := exec.Command("go", "env", "GOROOT").Output() + if err != nil { + return "", err + } + return strings.TrimSpace(string(out)), nil +}) + // IsStdRepo reports whether src is part of standard library. func (src *Source) IsStdRepo() (bool, error) { if len(src.Files) == 0 { @@ -788,7 +798,10 @@ func (src *Source) IsStdRepo() (bool, error) { if err != nil { return false, err } - goroot := runtime.GOROOT() + goroot, err := currentGOROOT() + if err != nil { + return false, err + } if runtime.GOOS == "windows" { abspath = strings.ToLower(abspath) goroot = strings.ToLower(goroot) @@ -839,13 +852,14 @@ func (src *Source) Generate(w io.Writer) error { funcMap := template.FuncMap{ "packagename": packagename, "syscalldot": syscalldot, + "windowsdot": windowsdot, "newlazydll": func(dll string) string { arg := "\"" + dll + ".dll\"" if !*systemDLL { return syscalldot() + "NewLazyDLL(" + arg + ")" } if strings.HasPrefix(dll, "api_") || strings.HasPrefix(dll, "ext_") { - arg = strings.Replace(arg, "_", "-", -1) + arg = strings.ReplaceAll(arg, "_", "-") } switch pkgtype { case pkgStd: @@ -944,12 +958,8 @@ var _ unsafe.Pointer // Do the interface allocations only once for common // Errno values. -const ( - errnoERROR_IO_PENDING = 997 -) - var ( - errERROR_IO_PENDING error = {{syscalldot}}Errno(errnoERROR_IO_PENDING) + errERROR_IO_PENDING error = {{windowsdot}}ERROR_IO_PENDING errERROR_EINVAL error = {{syscalldot}}EINVAL ) @@ -959,7 +969,7 @@ func errnoErr(e {{syscalldot}}Errno) error { switch e { case 0: return errERROR_EINVAL - case errnoERROR_IO_PENDING: + case {{windowsdot}}ERROR_IO_PENDING: return errERROR_IO_PENDING } {{- /* diff --git a/vendor/github.com/Microsoft/go-winio/vhd/zvhd_windows.go b/vendor/github.com/Microsoft/go-winio/vhd/zvhd_windows.go index e9d202ed5d..bcd753b8b9 100644 --- a/vendor/github.com/Microsoft/go-winio/vhd/zvhd_windows.go +++ b/vendor/github.com/Microsoft/go-winio/vhd/zvhd_windows.go @@ -15,12 +15,8 @@ var _ unsafe.Pointer // Do the interface allocations only once for common // Errno values. -const ( - errnoERROR_IO_PENDING = 997 -) - var ( - errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) + errERROR_IO_PENDING error = windows.ERROR_IO_PENDING errERROR_EINVAL error = syscall.EINVAL ) @@ -30,7 +26,7 @@ func errnoErr(e syscall.Errno) error { switch e { case 0: return errERROR_EINVAL - case errnoERROR_IO_PENDING: + case windows.ERROR_IO_PENDING: return errERROR_IO_PENDING } return e diff --git a/vendor/github.com/Microsoft/go-winio/zsyscall_windows.go b/vendor/github.com/Microsoft/go-winio/zsyscall_windows.go index 89b66eda8c..f4329bbfd6 100644 --- a/vendor/github.com/Microsoft/go-winio/zsyscall_windows.go +++ b/vendor/github.com/Microsoft/go-winio/zsyscall_windows.go @@ -15,12 +15,8 @@ var _ unsafe.Pointer // Do the interface allocations only once for common // Errno values. -const ( - errnoERROR_IO_PENDING = 997 -) - var ( - errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) + errERROR_IO_PENDING error = windows.ERROR_IO_PENDING errERROR_EINVAL error = syscall.EINVAL ) @@ -30,7 +26,7 @@ func errnoErr(e syscall.Errno) error { switch e { case 0: return errERROR_EINVAL - case errnoERROR_IO_PENDING: + case windows.ERROR_IO_PENDING: return errERROR_IO_PENDING } return e diff --git a/vendor/github.com/sirupsen/logrus/CHANGELOG.md b/vendor/github.com/sirupsen/logrus/CHANGELOG.md index 650f64988f..683cec9088 100644 --- a/vendor/github.com/sirupsen/logrus/CHANGELOG.md +++ b/vendor/github.com/sirupsen/logrus/CHANGELOG.md @@ -2,6 +2,21 @@ All notable changes to this project will be documented in this file. +## 1.10.2 + +Changed: + + * Update `github.com/stretchr/testify` to v1.12.1, removing the legacy + `gopkg.in/yaml.v3` dependency. + +## 1.10.1 + +Fixes: + + * Fix a regression introduced in v1.10.0 where `TextFormatter` could panic + when formatting nil or panicking `error` and `fmt.Stringer` values. + * Allow function-backed implementations of `error` as field values. + ## 1.10.0 Fixes: diff --git a/vendor/github.com/sirupsen/logrus/entry.go b/vendor/github.com/sirupsen/logrus/entry.go index 1cb4b5204c..82de41f9f8 100644 --- a/vendor/github.com/sirupsen/logrus/entry.go +++ b/vendor/github.com/sirupsen/logrus/entry.go @@ -159,15 +159,7 @@ func (entry *Entry) String() (string, error) { // WithError adds an error as single field (using the key defined in [ErrorKey]) // to the Entry. func (entry *Entry) WithError(err error) *Entry { - // Avoid reflection work in WithFields; we know the type is an error; - // copy the entry data and set the ErrorKey directly. - dup := entry.dup() - dup.Data = maps.Clone(entry.Data) - if dup.Data == nil { - dup.Data = make(Fields, 1) - } - dup.Data[ErrorKey] = err - return dup + return entry.WithField(ErrorKey, err) } // WithContext adds a context to the Entry. @@ -182,18 +174,7 @@ func (entry *Entry) WithContext(ctx context.Context) *Entry { func (entry *Entry) WithField(key string, value any) *Entry { dup := entry.dup() dup.Data = maps.Clone(entry.Data) - if isInvalidField(value) { - if dup.err != "" { - dup.err += ", skipping unsupported field " + strconv.Quote(key) - } else { - dup.err = "skipping unsupported field " + strconv.Quote(key) - } - return dup - } - if dup.Data == nil { - dup.Data = make(Fields, 1) - } - dup.Data[key] = value + dup.addField(key, value) return dup } @@ -204,27 +185,11 @@ func (entry *Entry) WithFields(fields Fields) *Entry { maps.Copy(dup.Data, entry.Data) for key, value := range fields { - if isInvalidField(value) { - if dup.err != "" { - dup.err += ", skipping unsupported field " + strconv.Quote(key) - } else { - dup.err = "skipping unsupported field " + strconv.Quote(key) - } - } else { - dup.Data[key] = value - } + dup.addField(key, value) } return dup } -func isInvalidField(v any) bool { - t := reflect.TypeOf(v) - if t == nil { - return false - } - return t.Kind() == reflect.Func || t.Kind() == reflect.Pointer && t.Elem().Kind() == reflect.Func -} - // WithTime overrides the time of the Entry. func (entry *Entry) WithTime(t time.Time) *Entry { dup := entry.dup() @@ -233,6 +198,25 @@ func (entry *Entry) WithTime(t time.Time) *Entry { return dup } +func (entry *Entry) addField(key string, value any) { + if _, ok := value.(error); !ok { + t := reflect.TypeOf(value) + if t != nil && (t.Kind() == reflect.Func || t.Kind() == reflect.Pointer && t.Elem().Kind() == reflect.Func) { + if entry.err != "" { + entry.err += ", skipping unsupported field " + strconv.Quote(key) + } else { + entry.err = "skipping unsupported field " + strconv.Quote(key) + } + return + } + } + + if entry.Data == nil { + entry.Data = make(Fields, 1) + } + entry.Data[key] = value +} + // getPackageName reduces a fully qualified function name to the package name // There really ought to be a better way... func getPackageName(f string) string { diff --git a/vendor/github.com/sirupsen/logrus/exported.go b/vendor/github.com/sirupsen/logrus/exported.go index 844691a941..8b261c124d 100644 --- a/vendor/github.com/sirupsen/logrus/exported.go +++ b/vendor/github.com/sirupsen/logrus/exported.go @@ -55,7 +55,7 @@ func AddHook(hook Hook) { // WithError creates an entry from the standard logger and adds an error to it, // using the value defined in [ErrorKey] as key. func WithError(err error) *Entry { - return std.WithField(ErrorKey, err) + return std.WithError(err) } // WithContext creates an entry from the standard logger and adds a context to it. diff --git a/vendor/github.com/sirupsen/logrus/text_formatter.go b/vendor/github.com/sirupsen/logrus/text_formatter.go index 9b0395adf0..82c1f3da24 100644 --- a/vendor/github.com/sirupsen/logrus/text_formatter.go +++ b/vendor/github.com/sirupsen/logrus/text_formatter.go @@ -5,6 +5,7 @@ import ( "fmt" "maps" "os" + "reflect" "runtime" "slices" "strconv" @@ -329,10 +330,10 @@ func (f *TextFormatter) appendValue(b *bytes.Buffer, value any) { f.appendBytes(b, strconv.AppendBool(raw[:0], v)) return case error: - f.appendString(b, v.Error()) + f.appendError(b, v) return case fmt.Stringer: - f.appendString(b, v.String()) + f.appendStringer(b, v) return } @@ -417,6 +418,29 @@ func (f *TextFormatter) appendNumeric(b *bytes.Buffer, out []byte) { b.Write(out) } +func (f *TextFormatter) appendError(b *bytes.Buffer, v error) { + defer f.recoverValue(b, v, "Error") + + f.appendString(b, v.Error()) +} + +func (f *TextFormatter) appendStringer(b *bytes.Buffer, v fmt.Stringer) { + defer f.recoverValue(b, v, "String") + + f.appendString(b, v.String()) +} + +func (f *TextFormatter) recoverValue(b *bytes.Buffer, v any, method string) { + if r := recover(); r != nil { + rv := reflect.ValueOf(v) + if rv.Kind() == reflect.Pointer && rv.IsNil() { + f.appendString(b, "") + } else { + f.appendString(b, fmt.Sprintf("%%!v(PANIC=%s method: %v)", method, r)) + } + } +} + // needsQuoting returns true if the string contains any byte that // requires quoting. It returns false when every byte is "safe" according // to isSafeByte. diff --git a/vendor/golang.org/x/tools/go/ast/astutil/imports.go b/vendor/golang.org/x/tools/go/ast/astutil/imports.go index adb4711019..6121bdd5f7 100644 --- a/vendor/golang.org/x/tools/go/ast/astutil/imports.go +++ b/vendor/golang.org/x/tools/go/ast/astutil/imports.go @@ -9,7 +9,6 @@ import ( "fmt" "go/ast" "go/token" - "reflect" "slices" "strconv" "strings" @@ -473,15 +472,10 @@ func Imports(fset *token.FileSet, f *ast.File) [][]*ast.ImportSpec { } // updateBasicLitPos updates lit.Pos, -// ensuring that lit.End (if set) is displaced by the same amount. +// ensuring that lit.End is displaced by the same amount. // (See https://go.dev/issue/76395.) func updateBasicLitPos(lit *ast.BasicLit, pos token.Pos) { len := lit.End() - lit.Pos() lit.ValuePos = pos - // TODO(adonovan): after go1.26, simplify to: - // lit.ValueEnd = pos + len - v := reflect.ValueOf(lit).Elem().FieldByName("ValueEnd") - if v.IsValid() && v.Int() != 0 { - v.SetInt(int64(pos + len)) - } + lit.ValueEnd = pos + len } diff --git a/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go b/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go index 7b90bc9235..e6159d7125 100644 --- a/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go +++ b/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go @@ -2,63 +2,44 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Package gcexportdata provides functions for reading and writing -// export data, which is a serialized description of the API of a Go -// package including the names, kinds, types, and locations of all -// exported declarations. -// -// The standard Go compiler (cmd/compile) writes an export data file -// for each package it compiles, which it later reads when compiling -// packages that import the earlier one. The compiler must thus -// contain logic to both write and read export data. -// (See the "Export" section in the cmd/compile/README file.) -// -// The [Read] function in this package can read files produced by the -// compiler, producing [go/types] data structures. As a matter of -// policy, Read supports export data files produced by only the last -// two Go releases plus tip; see https://go.dev/issue/68898. The -// export data files produced by the compiler contain additional -// details related to generics, inlining, and other optimizations that -// cannot be decoded by the [Read] function. -// -// In files written by the compiler, the export data is not at the -// start of the file. Before calling Read, use [NewReader] to locate -// the desired portion of the file. -// -// The [Write] function in this package encodes the exported API of a -// Go package ([types.Package]) as a file. Such files can be later -// decoded by Read, but cannot be consumed by the compiler. -// -// # Future changes -// -// Although Read supports the formats written by both Write and the -// compiler, the two are quite different, and there is an open -// proposal (https://go.dev/issue/69491) to separate these APIs. -// -// Under that proposal, this package would ultimately provide only the -// Read operation for compiler export data, which must be defined in -// this module (golang.org/x/tools), not in the standard library, to -// avoid version skew for developer tools that need to read compiler -// export data both before and after a Go release, such as from Go -// 1.23 to Go 1.24. Because this package lives in the tools module, -// clients can update their version of the module some time before the -// Go 1.24 release and rebuild and redeploy their tools, which will -// then be able to consume both Go 1.23 and Go 1.24 export data files, -// so they will work before and after the Go update. (See discussion -// at https://go.dev/issue/15651.) -// -// The operations to import and export [go/types] data structures -// would be defined in the go/types package as Import and Export. -// [Write] would (eventually) delegate to Export, -// and [Read], when it detects a file produced by Export, -// would delegate to Import. +// Package gcexportdata provides functions for writing and reading +// export data, a serialized representation of a [types.Package]. +// It describes the API of a Go package, including the names, +// kinds, types, and locations of all exported declarations. +// +// Files may be written and read using the [Write] and [Read] +// functions. +// Alternatively, files may be produced by the "go list -export" command. +// This command runs the type checker on each specified Go package and +// writes export data for each package into a file named by the Export +// field of go list's -json output. +// The [Read] function may then be used to read those files. +// +// The export data format evolves with each Go release. As a matter of +// policy, [Read] supports reading files produced by only the last two +// Go releases plus tip; see https://go.dev/issue/68898. +// +// The name of this package reflects its origins at a time when +// cmd/compile was named gc, and [Read] parsed export data +// from .a archives produced by the Go compiler. +// However, starting with go1.28, the format of the files +// produced by "go list -export" will diverge from the format +// used by the standard Go compiler. +// Consequently, this package will eventually stop being +// capable of reading those files. +// In the meantime, when using [Read] on a .a file written by the +// compiler, be aware that export data is not at the start of the file. +// Before calling Read, one must use [NewReader] to locate the export +// data section of the file. +// For more information on the compiler's export data, see the +// "Export" section in the GOROOT/src/cmd/compile/README file. // // # Deprecations // -// The [NewImporter] and [Find] functions are deprecated and should -// not be used in new code. The [WriteBundle] and [ReadBundle] -// functions are experimental, and there is an open proposal to -// deprecate them (https://go.dev/issue/69573). +// The [NewImporter], [Find], and [NewReader] functions are deprecated +// and should not be used in new code. +// The [WriteBundle] and [ReadBundle] functions are experimental, and +// there is an open proposal to deprecate them (https://go.dev/issue/69573). package gcexportdata import ( @@ -104,6 +85,9 @@ func Find(importPath, srcDir string) (filename, path string) { // NewReader returns a reader for the export data section of an object // (.o) or archive (.a) file read from r. The new reader may provide // additional trailing data beyond the end of the export data. +// +// Deprecated: This package will stop supporting the reading of export +// data from compiler-produced archive files in Go 1.29. func NewReader(r io.Reader) (io.Reader, error) { buf := bufio.NewReader(r) size, err := gcimporter.FindExportData(buf) @@ -176,16 +160,7 @@ func Read(in io.Reader, fset *token.FileSet, imports map[string]*types.Package, case 'i': // indexed, produced by cmd/compile till go1.19, // and also by [Write]. - // - // If proposal #69491 is accepted, go/types - // serialization will be implemented by - // types.Export, to which Write would eventually - // delegate (explicitly dropping any pretence at - // inter-version Write-Read compatibility). - // This [Read] function would delegate to types.Import - // when it detects that the file was produced by Export. - _, pkg, err := gcimporter.IImportData(fset, imports, data[1:], path) - return pkg, err + return gcimporter.IImportData(fset, imports, data[1:], path) case 'u': // unified, produced by cmd/compile since go1.20 diff --git a/vendor/golang.org/x/tools/internal/gcimporter/iexport.go b/vendor/golang.org/x/tools/internal/gcimporter/iexport.go index 686f171d3b..1dc51b7f94 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/iexport.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/iexport.go @@ -712,7 +712,7 @@ func (p *iexporter) doDecl(obj types.Object) { w.typ(obj.Type(), obj.Pkg()) case *types.Func: - sig, _ := obj.Type().(*types.Signature) + sig := obj.Type().(*types.Signature) if sig.Recv() != nil { // We shouldn't see methods in the package scope, // but the type checker may repair "func () F() {}" @@ -745,7 +745,7 @@ func (p *iexporter) doDecl(obj types.Object) { case *types.Const: w.tag(constTag) w.pos(obj.Pos()) - w.value(obj.Type(), obj.Val()) + w.value(obj.Type(), obj.Val(), obj.Pkg()) case *types.TypeName: t := obj.Type() @@ -822,7 +822,7 @@ func (p *iexporter) doDecl(obj types.Object) { m := named.Method(i) w.pos(m.Pos()) w.string(m.Name()) - sig, _ := m.Type().(*types.Signature) + sig := m.Type().(*types.Signature) if w.p.version >= iexportVersionGenericMethods && w.bool(sig.TypeParams().Len() > 0) { w.tparamList(obj.Name()+"."+m.Name(), sig.TypeParams(), obj.Pkg()) } @@ -970,9 +970,11 @@ func (w *exportWriter) qualifiedType(obj *types.TypeName) { // typ emits the specified type. // // Objects within the type (struct fields and interface methods) are -// qualified by pkg. It may be nil if the type cannot contain objects, -// such as the type of a constant. +// qualified by pkg. func (w *exportWriter) typ(t types.Type, pkg *types.Package) { + if pkg == nil { + pkg = w.p.localpkg + } w.data.uint64(w.p.typOff(t, pkg)) } @@ -1148,7 +1150,7 @@ func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) { } w.pos(m.Pos()) w.string(m.Name()) - sig, _ := m.Type().(*types.Signature) + sig := m.Type().(*types.Signature) w.signature(sig) } @@ -1295,8 +1297,12 @@ func (w *exportWriter) param(obj types.Object) { w.typ(obj.Type(), obj.Pkg()) } -func (w *exportWriter) value(typ types.Type, v constant.Value) { - w.typ(typ, nil) +// only called for constants +func (w *exportWriter) value(typ types.Type, v constant.Value, pkg *types.Package) { + if pkg == nil { + pkg = w.p.localpkg + } + w.typ(typ, pkg) if w.p.version >= iexportVersionGo1_18 { w.int64(int64(v.Kind())) } diff --git a/vendor/golang.org/x/tools/internal/gcimporter/iimport.go b/vendor/golang.org/x/tools/internal/gcimporter/iimport.go index 7b1723e0fc..06f07bc3b0 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/iimport.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/iimport.go @@ -30,14 +30,6 @@ type intReader struct { path string } -func (r *intReader) int64() int64 { - i, err := binary.ReadVarint(r.Reader) - if err != nil { - errorf("import %q: read varint error: %v", r.path, err) - } - return i -} - func (r *intReader) uint64() uint64 { i, err := binary.ReadUvarint(r.Reader) if err != nil { @@ -101,12 +93,12 @@ const ( // and returns 0 and a reference to the package. // If the export data version is not recognized or the format is otherwise // compromised, an error is returned. -func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (int, *types.Package, error) { +func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (*types.Package, error) { pkgs, err := iimportCommon(fset, GetPackagesFromMap(imports), data, false, path, false, nil) if err != nil { - return 0, nil, err + return nil, err } - return 0, pkgs[0], nil + return pkgs[0], nil } // IImportBundle imports a set of packages from the serialized package bundle. diff --git a/vendor/golang.org/x/tools/internal/gcimporter/ureader.go b/vendor/golang.org/x/tools/internal/gcimporter/ureader.go index 5d3b7c867a..3c258c2e85 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/ureader.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/ureader.go @@ -629,11 +629,26 @@ func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) { }) } - for i, n := 0, r.Len(); i < n; i++ { - named.AddMethod(r.method()) - } - if r.Version().Has(pkgbits.GenericMethods) { + // V4 (go1.27.0) emitted all non-generic methods + // before all generic ones, discarding source + // order: a bug (go.dev/issue/81188). + // V5 (go1.27.x) fixes it by emitting an explicit + // index along with each method. + type indexedMethod struct { + index int // (or -1 in V4) + fn *types.Func + } + + var methods []indexedMethod + + // ordinary methods + for range r.Len() { + idx, m := r.method() + methods = append(methods, indexedMethod{idx, m}) + } + + // generic methods for range r.Len() { // Careful: objIdx is used to read in package-scoped declarations, which // methods are not. Instead, decode it here. This makes it easier to @@ -648,11 +663,31 @@ func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) { pkg, name := r.selector() rtparams := r.typeParamNames(true) recv := r.param() + methodIdx := -1 + if r.Version().Has(pkgbits.PreserveMethodOrder) { + methodIdx = r.Len() + } tparams := r.typeParamNames(false) sig := r.signature(recv, rtparams, tparams) pr.retireReader(r) - named.AddMethod(types.NewFunc(pos, pkg, name, sig)) + methods = append(methods, indexedMethod{methodIdx, types.NewFunc(pos, pkg, name, sig)}) + } + + if r.Version().Has(pkgbits.PreserveMethodOrder) { + sort.Slice(methods, func(i, j int) bool { + return methods[i].index < methods[j].index + }) + } + + for _, m := range methods { + named.AddMethod(m.fn) + } + + } else { + for range r.Len() { + _, m := r.method() + named.AddMethod(m) } } @@ -766,8 +801,12 @@ func (r *reader) typeParamNames(isGenMeth bool) []*types.TypeParam { return tparams } -func (r *reader) method() *types.Func { +func (r *reader) method() (int, *types.Func) { r.Sync(pkgbits.SyncMethod) + idx := -1 + if r.Version().Has(pkgbits.PreserveMethodOrder) { + idx = r.Len() + } pos := r.pos() pkg, name := r.selector() @@ -775,7 +814,7 @@ func (r *reader) method() *types.Func { sig := r.signature(r.param(), rparams, nil) _ = r.pos() // TODO(mdempsky): Remove; this is a hacker for linker.go. - return types.NewFunc(pos, pkg, name, sig) + return idx, types.NewFunc(pos, pkg, name, sig) } func (r *reader) qualifiedIdent() (*types.Package, string) { return r.ident(pkgbits.SyncSym) } diff --git a/vendor/golang.org/x/tools/internal/imports/fix.go b/vendor/golang.org/x/tools/internal/imports/fix.go index 6aa1e27e3a..2cb50aea6c 100644 --- a/vendor/golang.org/x/tools/internal/imports/fix.go +++ b/vendor/golang.org/x/tools/internal/imports/fix.go @@ -463,6 +463,15 @@ func sortFixes(fixes []*ImportFix) { }) } +func hasDeleteFix(fixes []*ImportFix) bool { + for _, fix := range fixes { + if fix.FixType == DeleteImport { + return true + } + } + return false +} + // importSpecName gets the import name of imp in the import spec. // // When the import identifier matches the assumed import name, the import name does @@ -579,17 +588,6 @@ func getFixes(ctx context.Context, fset *token.FileSet, f *ast.File, filename st } func getFixesWithSource(ctx context.Context, fset *token.FileSet, f *ast.File, filename string, goroot string, logf func(string, ...any), source Source) ([]*ImportFix, error) { - // If there is an Index for the GOMODCACHE, remember that, and later make it so that the - // directory walk doesn't go into the module cache, since we already have all the information - var ix *modindex.Index - src, ok := source.(*ProcessEnvSource) - if ok { - var err error - if ix, err = modindex.Read(src.env.Env["GOMODCACHE"]); err != nil { - ix = nil // don't use it if there was an error - } - } - // This logic is defensively duplicated from getFixes. abs, err := filepath.Abs(filename) if err != nil { @@ -632,7 +630,7 @@ func getFixesWithSource(ctx context.Context, fset *token.FileSet, f *ast.File, f // Now we can try adding imports from the stdlib. p.assumeSiblingImportsValid() addStdlibCandidates(p, p.missingRefs) - if fixes, done := p.fix(); done { + if fixes, done := p.fix(); done && !hasDeleteFix(fixes) { return fixes, nil } @@ -648,6 +646,17 @@ func getFixesWithSource(ctx context.Context, fset *token.FileSet, f *ast.File, f } p.loadRealPackageNames = true p.otherFiles = otherFiles + + // If there is an Index for the GOMODCACHE, remember that, and later make it so that the + // directory walk doesn't go into the module cache, since we already have all the information. + var ix *modindex.Index + if src, ok := source.(*ProcessEnvSource); ok { + var err error + if ix, err = modindex.Read(src.env.Env["GOMODCACHE"]); err != nil { + ix = nil // don't use it if there was an error + } + } + if ix != nil { src, ok := p.source.(*ProcessEnvSource) if ok { diff --git a/vendor/golang.org/x/tools/internal/imports/sortimports.go b/vendor/golang.org/x/tools/internal/imports/sortimports.go index f390be90f1..ca713cb777 100644 --- a/vendor/golang.org/x/tools/internal/imports/sortimports.go +++ b/vendor/golang.org/x/tools/internal/imports/sortimports.go @@ -11,7 +11,6 @@ import ( "go/ast" "go/token" "log" - "reflect" "slices" "sort" "strconv" @@ -299,15 +298,10 @@ func (x byCommentPos) Swap(i, j int) { x[i], x[j] = x[j], x[i] } func (x byCommentPos) Less(i, j int) bool { return x[i].Pos() < x[j].Pos() } // updateBasicLitPos updates lit.Pos, -// ensuring that lit.End (if set) is displaced by the same amount. +// ensuring that lit.End is displaced by the same amount. // (See https://go.dev/issue/76395.) func updateBasicLitPos(lit *ast.BasicLit, pos token.Pos) { len := lit.End() - lit.Pos() lit.ValuePos = pos - // TODO(adonovan): after go1.26, simplify to: - // lit.ValueEnd = pos + len - v := reflect.ValueOf(lit).Elem().FieldByName("ValueEnd") - if v.IsValid() && v.Int() != 0 { - v.SetInt(int64(pos + len)) - } + lit.ValueEnd = pos + len } diff --git a/vendor/golang.org/x/tools/internal/modindex/index.go b/vendor/golang.org/x/tools/internal/modindex/index.go index 2938104c72..73ea82972c 100644 --- a/vendor/golang.org/x/tools/internal/modindex/index.go +++ b/vendor/golang.org/x/tools/internal/modindex/index.go @@ -14,6 +14,8 @@ import ( "path/filepath" "strconv" "strings" + "sync" + "sync/atomic" "testing" "time" ) @@ -66,6 +68,9 @@ whose types are []byte and interface{}. const CurrentVersion int = 0 // Index is returned by [Read]. +// +// An Index is immutable once constructed: [Read] may return the same +// Index to multiple callers, so it must not be modified. type Index struct { Version int GOMODCACHE string // absolute path of Go module cache dir @@ -118,9 +123,37 @@ var IndexDir string = func() string { return dir }() +// cache memoizes the most recently read index for each Go module cache +// directory; see [Read]. +var cache sync.Map // from gomodcache (string) to *cacheEntry + +type cacheEntry struct { + payloadFile string // the file the index was read from + index *Index +} + +// parseCount counts the number of times [Read] has parsed a payload +// file, as opposed to returning a memoized index. It is for testing. +var parseCount atomic.Int64 + // Read reads the latest version of the on-disk index // for the specified Go module cache directory. // If there is no index, it returns a nil Index and an fs.ErrNotExist error. +// +// The result is memoized: parsing the payload file, which may be +// hundreds of megabytes, is far more expensive than the rest of the +// work done by a typical client such as [golang.org/x/tools/imports.Process], +// and clients that process many files would otherwise repeat it for +// each one. Because payload files are immutable--[write] gives each +// one a fresh random name and only then updates the link file to refer +// to it--the name of the payload file is a sound cache key, so an index +// created by another process is picked up as soon as the link file +// changes. Only the most recent index for each directory is retained, +// so that a long-running process that repeatedly updates the index does +// not accumulate stale ones. +// +// Consequently the same Index may be returned to multiple callers, and +// callers must not modify it. func Read(gomodcache string) (*Index, error) { gomodcache, err := filepath.Abs(gomodcache) if err != nil { @@ -138,13 +171,26 @@ func Read(gomodcache string) (*Index, error) { } payloadFile := filepath.Join(IndexDir, string(content)) + // Is the index from that payload file already in memory? + if v, ok := cache.Load(gomodcache); ok { + if e := v.(*cacheEntry); e.payloadFile == payloadFile { + return e.index, nil + } + } + // Read the index out of the payload file. f, err := os.Open(payloadFile) if err != nil { return nil, err } defer f.Close() - return readIndexFrom(gomodcache, bufio.NewReader(f)) + parseCount.Add(1) + ix, err := readIndexFrom(gomodcache, bufio.NewReader(f)) + if err != nil { + return nil, err + } + cache.Store(gomodcache, &cacheEntry{payloadFile, ix}) + return ix, nil } func readIndexFrom(gomodcache string, r io.Reader) (*Index, error) { diff --git a/vendor/golang.org/x/tools/internal/pkgbits/version.go b/vendor/golang.org/x/tools/internal/pkgbits/version.go index 0db9652748..684b471753 100644 --- a/vendor/golang.org/x/tools/internal/pkgbits/version.go +++ b/vendor/golang.org/x/tools/internal/pkgbits/version.go @@ -37,6 +37,10 @@ const ( // V4: encodes generic methods as standalone function objects V4 + // V5: encodes the index of methods to preserve relative order + // of nongeneric and generic methods (go.dev/issue/81188). + V5 + numVersions = iota ) @@ -76,6 +80,10 @@ const ( // Generic methods may appear as standalone function objects. GenericMethods + // Method index is encoded to preserve relative order of + // nongeneric and generic methods. + PreserveMethodOrder + numFields = iota ) @@ -85,6 +93,7 @@ var introduced = [numFields]Version{ AliasTypeParamNames: V2, CompactCompLiterals: V3, GenericMethods: V4, + PreserveMethodOrder: V5, } // removed is the version a field was removed in or 0 for fields diff --git a/vendor/golang.org/x/tools/internal/stdlib/deps.go b/vendor/golang.org/x/tools/internal/stdlib/deps.go index b049e5f977..abd3c8754b 100644 --- a/vendor/golang.org/x/tools/internal/stdlib/deps.go +++ b/vendor/golang.org/x/tools/internal/stdlib/deps.go @@ -44,7 +44,7 @@ var deps = [...]pkginfo{ {"crypto/internal/boring/bcache", "\xcf\x02\x14"}, {"crypto/internal/boring/sig", ""}, {"crypto/internal/constanttime", ""}, - {"crypto/internal/cryptotest", "\x03\r\v\n%\x11\x1a\r\x12\x12!\x04\x06\n\x19\x01\x11\x11\x1d\x01\a\x03\x02\b\x02\x01\x05\f"}, + {"crypto/internal/cryptotest", "\x03\r\v\n%\x11\x1a\r\x12\x12!\x04\x06\n\x19\x01\x11\x11\x1d\x01\a\x03\x02\b\x02\x01\x04\x01\f"}, {"crypto/internal/cryptotest/wycheproof", "\x0e\x12T\x01\f\x01r@\x05\x03\x15\x10"}, {"crypto/internal/cryptotest/x509limbo", "u\n\x03\xba\x01\x03\x1e"}, {"crypto/internal/entropy", "M"}, @@ -122,7 +122,7 @@ var deps = [...]pkginfo{ {"embed/internal/embedtest", ""}, {"encoding", ""}, {"encoding/ascii85", "\x86\x02E"}, - {"encoding/asn1", "\x03|\x03h(\x01)\r\x02\x01\x11\x03\x01"}, + {"encoding/asn1", "\x03|\x03h(\x01)\x05\b\x02\x01\x11\x03\x01"}, {"encoding/base32", "\x86\x02C\x02"}, {"encoding/base64", "\xaa\x01\\C\x02"}, {"encoding/binary", "\x7f\x87\x01\f*\r\x05"}, @@ -319,7 +319,7 @@ var deps = [...]pkginfo{ {"net/rpc/jsonrpc", "u\n\x03\x84\x01\x16\x13\x1f"}, {"net/smtp", "\x196\r\x14\x0f\x03\x84\x01\x16\x16\x1a"}, {"net/textproto", "\x02\x01|\x03\x84\x01\f\n/\x01\x02\x15"}, - {"net/url", "\x7f\x03Ff\v\x10\x02\x01\x17"}, + {"net/url", "\x03|\x03Ff\v\x10\x02\x01\x17"}, {"os", "\x7f*\x01\x19\x04\x11\x14\x01\x03\x01\x05\x10\x01:\b\x05\x01\x01\r\x06"}, {"os/exec", "\x03\nrI(\x01\x15\x01-\x06\a\n\x01\x03\x01\r"}, {"os/exec/internal/fdtest", "\xd0\x02"}, diff --git a/vendor/golang.org/x/tools/internal/typesinternal/types.go b/vendor/golang.org/x/tools/internal/typesinternal/types.go index 9fd48b088f..3e4c7c3bd6 100644 --- a/vendor/golang.org/x/tools/internal/typesinternal/types.go +++ b/vendor/golang.org/x/tools/internal/typesinternal/types.go @@ -271,6 +271,8 @@ func ImplicitFieldSelections(seln types.Selection) iter.Seq2[*types.Var, bool] { } } +// TupleOf returns a tuple type with the specified list of (unnamed) +// var types. Neither the zero nor one cases are special. func TupleOf(elems ...types.Type) *types.Tuple { params := make([]*types.Var, len(elems)) for i, elem := range elems { diff --git a/vendor/modules.txt b/vendor/modules.txt index 76e6e2f435..f1003a091a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -10,8 +10,8 @@ github.com/Microsoft/cosesign1go/pkg/cosesign1 # github.com/Microsoft/didx509go v0.0.3 ## explicit; go 1.20 github.com/Microsoft/didx509go/pkg/did-x509-resolver -# github.com/Microsoft/go-winio v0.6.3-0.20260917205003-526e22f39a0a -## explicit; go 1.23.0 +# github.com/Microsoft/go-winio v0.6.3 +## explicit; go 1.26.0 github.com/Microsoft/go-winio github.com/Microsoft/go-winio/backuptar github.com/Microsoft/go-winio/internal/fs @@ -523,7 +523,7 @@ github.com/segmentio/asm/cpu/arm64 github.com/segmentio/asm/cpu/cpuid github.com/segmentio/asm/cpu/x86 github.com/segmentio/asm/internal/unsafebytes -# github.com/sirupsen/logrus v1.10.0 +# github.com/sirupsen/logrus v1.10.2 ## explicit; go 1.23 github.com/sirupsen/logrus # github.com/tchap/go-patricia/v2 v2.3.3 @@ -684,8 +684,8 @@ golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm -# golang.org/x/tools v0.49.0 -## explicit; go 1.25.0 +# golang.org/x/tools v0.50.0 +## explicit; go 1.26.0 golang.org/x/tools/go/ast/astutil golang.org/x/tools/go/ast/edge golang.org/x/tools/go/ast/inspector From 025f1b9d402f8b5cda5b589a821b0a7fc0b0bd03 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 11 Oct 2026 03:53:45 +0000 Subject: [PATCH 2/2] go mod tidy && go mod vendor Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- test/go.mod | 4 ++-- test/go.sum | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/go.mod b/test/go.mod index dd1993b9c4..a69625c1ba 100644 --- a/test/go.mod +++ b/test/go.mod @@ -3,7 +3,7 @@ module github.com/Microsoft/hcsshim/test go 1.26.8 require ( - github.com/Microsoft/go-winio v0.6.3-0.20260917205003-526e22f39a0a + github.com/Microsoft/go-winio v0.6.3 github.com/Microsoft/hcsshim v0.15.0-rc.1 github.com/containerd/cgroups/v3 v3.1.3 github.com/containerd/containerd/api v1.11.1 @@ -19,7 +19,7 @@ require ( github.com/opencontainers/runtime-spec v1.3.0 github.com/opencontainers/runtime-tools v0.9.1-0.20260316125833-8a4db579f5c8 github.com/pkg/errors v0.9.1 - github.com/sirupsen/logrus v1.10.0 + github.com/sirupsen/logrus v1.10.2 github.com/urfave/cli/v2 v2.27.7 go.opentelemetry.io/otel v1.46.0 go.opentelemetry.io/otel/sdk v1.46.0 diff --git a/test/go.sum b/test/go.sum index eb10cec225..da13a0e380 100644 --- a/test/go.sum +++ b/test/go.sum @@ -6,8 +6,8 @@ github.com/Microsoft/cosesign1go v1.7.0 h1:uf/zRnSzfZaCjqgw9e+wwsqbe9J1sLZZEsEjs github.com/Microsoft/cosesign1go v1.7.0/go.mod h1:7x+fdYtZ4ureEgfVtl2K+nY4MMfujMsCIb5kRuncpmg= github.com/Microsoft/didx509go v0.0.3 h1:n/owuFOXVzCEzSyzivMEolKEouBm9G0NrEDgoTekM8A= github.com/Microsoft/didx509go v0.0.3/go.mod h1:wWt+iQsLzn3011+VfESzznLIp/Owhuj7rLF7yLglYbk= -github.com/Microsoft/go-winio v0.6.3-0.20260917205003-526e22f39a0a h1:fAOaVG8riXgBe8ACxoYCTv8191XXOvQ7q5BKfig48i8= -github.com/Microsoft/go-winio v0.6.3-0.20260917205003-526e22f39a0a/go.mod h1:ZWa7ssZJT30CCDGJ7fk/2SBTq9BIQrrVjrcss0UW2s0= +github.com/Microsoft/go-winio v0.6.3 h1:M/52tsoyTfwaxajLnXZm7PqkbMGRH8iSWP+8fcg9MQ4= +github.com/Microsoft/go-winio v0.6.3/go.mod h1:ma0QpxizD4fyyzJ1C7MIblymTD2Nxz5Mho/3CepwIZg= github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= @@ -218,8 +218,8 @@ github.com/seccomp/libseccomp-golang v0.11.1 h1:wuk4ZjSx6kyQII4rj6G6fvVzRHQaSiPv github.com/seccomp/libseccomp-golang v0.11.1/go.mod h1:5m1Lk8E9OwgZTTVz4bBOer7JuazaBa+xTkM895tDiWc= github.com/segmentio/asm v1.2.1 h1:DTNbBqs57ioxAD4PrArqftgypG4/qNpXoJx8TVXxPR0= github.com/segmentio/asm v1.2.1/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= -github.com/sirupsen/logrus v1.10.0 h1:T8MxJJXVZkfcC5zSRMRAg2F8+lxjmUCGGWPzFxO+Msc= -github.com/sirupsen/logrus v1.10.0/go.mod h1:FXZFonkDAnFozmO+5hGAFvB0Yg9/j2SIhA/QuIkP180= +github.com/sirupsen/logrus v1.10.2 h1:G2SED73/qrAu6YwbdxOD6peLkCBI3z7L+ykJFTXJBBo= +github.com/sirupsen/logrus v1.10.2/go.mod h1:SLEg8TqYulVKKfIGHldVp2K2aYz2DKSVBq4g/H5bR7Q= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -290,8 +290,8 @@ golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= -golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI= -golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo= +golang.org/x/tools v0.50.0 h1:c2ifzfcuY7L90lZ2aKd8S4K2NpASF08SZx9ZuJkHmSU= +golang.org/x/tools v0.50.0/go.mod h1:7ulVMw3831Mwi5EZD6RomGyffr4VFjuNYXf2BbCEAV0= gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= google.golang.org/genproto/googleapis/rpc v0.0.0-20260825221802-da73d73af1c5 h1:1VUiZAXyC+zmiFYi+WLtBzr68Cj8wOofHjjrA/kkizc=