Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: update golang to 1.24.1#17035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
sreya merged 42 commits intomainfromgo-1.24.1-update
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
42 commits
Select commitHold shift + click to select a range
5df49f9
feat: update Go version to 1.24.1
Mar 21, 2025
83e79be
refactor: simplify Go 1.24.1 update
Mar 21, 2025
57a47e0
revert: simplify change to go version only
Mar 21, 2025
8187c9e
fix: update guts dependency to support Go 1.24.1
Mar 21, 2025
5aaf404
fix: update golangci-lint tool for Go 1.24.1
Mar 21, 2025
d7160ae
fix: temporarily disable Go linting due to Go 1.24.1 compatibility is…
Mar 21, 2025
3c3aa21
fix: update golangci-lint to v1.57.1 for Go 1.24.1 compatibility
Mar 21, 2025
4710808
fix: upgrade golangci-lint to v1.64.8
Mar 21, 2025
2bcb38a
revert: restore original lint/go implementation in Makefile
Mar 21, 2025
651d489
fix: restore original Makefile structure with continue-on-error for l…
Mar 21, 2025
77b2908
chore: remove continue-on-error behavior from lint/go
Mar 21, 2025
226e838
update golangci rules
sreyaMar 24, 2025
02fd64a
fix config
sreyaMar 24, 2025
3d07833
ignore unused parameters in tests
sreyaMar 25, 2025
75be2c3
update golangci rules
sreyaMar 25, 2025
2b19287
more updates
sreyaMar 25, 2025
ee44d98
fix: Add #nosec G115 annotations to address integer overflow conversi…
sreyaMar 25, 2025
f8af6a8
fix: Add more #nosec G115 annotations for integer overflow warnings
sreyaMar 25, 2025
3cf7102
fix: address G115 integer overflow linter warnings for Go 1.24.1
sreyaMar 25, 2025
527df65
fix: address more G115 integer overflow linter warnings
sreyaMar 25, 2025
7d11352
refactor: replace if-else chains with switch statements
sreyaMar 25, 2025
59e1b9c
fix: resolve unused parameter linter issues for Go 1.24.1 compatibility
sreyaMar 25, 2025
bb5aa17
fix: resolve unused-parameter warnings for Go 1.24.1 compatibility
sreyaMar 26, 2025
0b3571a
errname and fix changes
sreyaMar 26, 2025
7f93228
more fixes
sreyaMar 26, 2025
792b4b5
fix compilation error
sreyaMar 26, 2025
a4f441a
fix: resolve G115 integer overflow conversion warnings for Go 1.24.1 …
sreyaMar 26, 2025
5caf54d
fix: convert if-else chains to switch statements for Go 1.24.1 compat…
sreyaMar 26, 2025
d9b665c
fix abhorrent edits
sreyaMar 26, 2025
7e0ceec
fix more linting rules
sreyaMar 26, 2025
1530bfb
fix agent
sreyaMar 26, 2025
9ae5514
fix more stuff
sreyaMar 26, 2025
e2e1e17
fix test
sreyaMar 26, 2025
f3f5755
fix: resolve remaining redefines-builtin-id linting issues
sreyaMar 26, 2025
9b0a218
fix appendAssign
sreyaMar 26, 2025
d3581a8
fix: resolve deferUnlambda linting issues by simplifying defer statem…
sreyaMar 26, 2025
1bb7942
fix ifelse
sreyaMar 26, 2025
31311d3
fix assignOp linting errors
Mar 26, 2025
3b93057
Revert "fix: resolve deferUnlambda linting issues by simplifying defe…
sreyaMar 26, 2025
3a4ac1e
unlambda && make gen
sreyaMar 26, 2025
38de0cf
don't commit dbmock
sreyaMar 26, 2025
3afeb90
make gen
sreyaMar 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion.github/actions/setup-go/action.yaml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@ description: |
inputs:
version:
description: "The Go version to use."
default: "1.22.12"
default: "1.24.1"
runs:
using: "composite"
steps:
Expand Down
15 changes: 11 additions & 4 deletions.golangci.yaml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -203,6 +203,14 @@ linters-settings:
- G601

issues:
exclude-dirs:
- coderd/database/dbmem
- node_modules
- .git

skip-files:
- scripts/rules.go

# Rules listed here: https://github.com/securego/gosec#available-rules
exclude-rules:
- path: _test\.go
Expand All@@ -211,6 +219,8 @@ issues:
- errcheck
- forcetypeassert
- exhaustruct # This is unhelpful in tests.
- revive # TODO(JonA): disabling in order to update golangci-lint
- gosec # TODO(JonA): disabling in order to update golangci-lint
- path: scripts/*
linters:
- exhaustruct
Expand All@@ -220,12 +230,9 @@ issues:
max-same-issues: 0

run:
skip-dirs:
- node_modules
- .git
timeout: 10m
skip-files:
- scripts/rules.go
timeout: 10m

# Over time, add more and more linters from
# https://golangci-lint.run/usage/linters/ as the code improves.
Expand Down
18 changes: 12 additions & 6 deletionsagent/agent.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -936,7 +936,7 @@ func (a *agent) run() (retErr error) {
connMan.startAgentAPI("send logs", gracefulShutdownBehaviorRemain,
func(ctx context.Context, aAPI proto.DRPCAgentClient24) error {
err := a.logSender.SendLoop(ctx, aAPI)
if xerrors.Is(err, agentsdk.LogLimitExceededError) {
if xerrors.Is(err, agentsdk.ErrLogLimitExceeded) {
// we don't want this error to tear down the API connection and propagate to the
// other routines that use the API. The LogSender has already dropped a warning
// log, so just return nil here.
Expand DownExpand Up@@ -1564,9 +1564,13 @@ func (a *agent) Collect(ctx context.Context, networkStats map[netlogtype.Connect
}
for conn, counts := range networkStats {
stats.ConnectionsByProto[conn.Proto.String()]++
// #nosec G115 - Safe conversions for network statistics which we expect to be within int64 range
stats.RxBytes += int64(counts.RxBytes)
// #nosec G115 - Safe conversions for network statistics which we expect to be within int64 range
stats.RxPackets += int64(counts.RxPackets)
// #nosec G115 - Safe conversions for network statistics which we expect to be within int64 range
stats.TxBytes += int64(counts.TxBytes)
// #nosec G115 - Safe conversions for network statistics which we expect to be within int64 range
stats.TxPackets += int64(counts.TxPackets)
}

Expand DownExpand Up@@ -1619,11 +1623,12 @@ func (a *agent) Collect(ctx context.Context, networkStats map[netlogtype.Connect
wg.Wait()
sort.Float64s(durations)
durationsLength := len(durations)
if durationsLength == 0 {
switch {
case durationsLength == 0:
stats.ConnectionMedianLatencyMs = -1
} else ifdurationsLength%2 == 0 {
casedurationsLength%2 == 0:
stats.ConnectionMedianLatencyMs = (durations[durationsLength/2-1] + durations[durationsLength/2]) / 2
} else {
default:
stats.ConnectionMedianLatencyMs = durations[durationsLength/2]
}
// Convert from microseconds to milliseconds.
Expand DownExpand Up@@ -1730,7 +1735,7 @@ func (a *agent) HTTPDebug() http.Handler {
r.Get("/debug/magicsock", a.HandleHTTPDebugMagicsock)
r.Get("/debug/magicsock/debug-logging/{state}", a.HandleHTTPMagicsockDebugLoggingState)
r.Get("/debug/manifest", a.HandleHTTPDebugManifest)
r.NotFound(func(w http.ResponseWriter,r *http.Request) {
r.NotFound(func(w http.ResponseWriter,_ *http.Request) {
w.WriteHeader(http.StatusNotFound)
_, _ = w.Write([]byte("404 not found"))
})
Expand DownExpand Up@@ -2016,7 +2021,7 @@ func (a *apiConnRoutineManager) wait() error {
}

func PrometheusMetricsHandler(prometheusRegistry *prometheus.Registry, logger slog.Logger) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter,r *http.Request) {
return http.HandlerFunc(func(w http.ResponseWriter,_ *http.Request) {
w.Header().Set("Content-Type", "text/plain")

// Based on: https://github.com/tailscale/tailscale/blob/280255acae604796a1113861f5a84e6fa2dc6121/ipn/localapi/localapi.go#L489
Expand DownExpand Up@@ -2052,5 +2057,6 @@ func WorkspaceKeySeed(workspaceID uuid.UUID, agentName string) (int64, error) {
return 42, err
}

// #nosec G115 - Safe conversion to generate int64 hash from Sum64, data loss acceptable
return int64(h.Sum64()), nil
}
7 changes: 5 additions & 2 deletionsagent/agentcontainers/containers_dockercli.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -453,8 +453,9 @@ func convertDockerInspect(raw []byte) ([]codersdk.WorkspaceAgentContainer, []str
hostPortContainers[hp] = append(hostPortContainers[hp], in.ID)
}
out.Ports = append(out.Ports, codersdk.WorkspaceAgentContainerPort{
Network: network,
Port: cp,
Network: network,
Port: cp,
// #nosec G115 - Safe conversion since Docker ports are limited to uint16 range
HostPort: uint16(hp),
HostIP: p.HostIP,
})
Expand DownExpand Up@@ -497,12 +498,14 @@ func convertDockerPort(in string) (uint16, string, error) {
if err != nil {
return 0, "", xerrors.Errorf("invalid port format: %s", in)
}
// #nosec G115 - Safe conversion since Docker TCP ports are limited to uint16 range
return uint16(p), "tcp", nil
case 2:
p, err := strconv.Atoi(parts[0])
if err != nil {
return 0, "", xerrors.Errorf("invalid port format: %s", in)
}
// #nosec G115 - Safe conversion since Docker ports are limited to uint16 range
return uint16(p), parts[1], nil
default:
return 0, "", xerrors.Errorf("invalid port format: %s", in)
Expand Down
1 change: 1 addition & 0 deletionsagent/agentrsa/key_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,6 +28,7 @@ func BenchmarkGenerateDeterministicKey(b *testing.B) {
for range b.N {
// always record the result of DeterministicPrivateKey to prevent
// the compiler eliminating the function call.
// #nosec G404 - Using math/rand is acceptable for benchmarking deterministic keys
r = agentrsa.GenerateDeterministicKey(rand.Int64())
}

Expand Down
5 changes: 3 additions & 2 deletionsagent/agentssh/agentssh.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -223,7 +223,7 @@ func NewServer(ctx context.Context, logger slog.Logger, prometheusRegistry *prom
slog.F("destination_port", destinationPort))
return true
},
PtyCallback: func(ctx ssh.Context,pty ssh.Pty) bool {
PtyCallback: func(_ ssh.Context,_ ssh.Pty) bool {
return true
},
ReversePortForwardingCallback: func(ctx ssh.Context, bindHost string, bindPort uint32) bool {
Expand All@@ -240,7 +240,7 @@ func NewServer(ctx context.Context, logger slog.Logger, prometheusRegistry *prom
"cancel-streamlocal-forward@openssh.com": unixForwardHandler.HandleSSHRequest,
},
X11Callback: s.x11Callback,
ServerConfigCallback: func(ctx ssh.Context) *gossh.ServerConfig {
ServerConfigCallback: func(_ ssh.Context) *gossh.ServerConfig {
return &gossh.ServerConfig{
NoClientAuth: true,
}
Expand DownExpand Up@@ -702,6 +702,7 @@ func (s *Server) startPTYSession(logger slog.Logger, session ptySession, magicTy
windowSize = nil
continue
}
// #nosec G115 - Safe conversions for terminal dimensions which are expected to be within uint16 range
resizeErr := ptty.Resize(uint16(win.Height), uint16(win.Width))
// If the pty is closed, then command has exited, no need to log.
if resizeErr != nil && !errors.Is(resizeErr, pty.ErrClosed) {
Expand Down
7 changes: 6 additions & 1 deletionagent/agentssh/x11.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -116,7 +116,8 @@ func (s *Server) x11Handler(ctx ssh.Context, x11 ssh.X11) (displayNumber int, ha
OriginatorPort uint32
}{
OriginatorAddress: tcpAddr.IP.String(),
OriginatorPort: uint32(tcpAddr.Port),
// #nosec G115 - Safe conversion as TCP port numbers are within uint32 range (0-65535)
OriginatorPort: uint32(tcpAddr.Port),
}))
if err != nil {
s.logger.Warn(ctx, "failed to open X11 channel", slog.Error(err))
Expand DownExpand Up@@ -294,6 +295,7 @@ func addXauthEntry(ctx context.Context, fs afero.Fs, host string, display string
return xerrors.Errorf("failed to write family: %w", err)
}

// #nosec G115 - Safe conversion for host name length which is expected to be within uint16 range
err = binary.Write(file, binary.BigEndian, uint16(len(host)))
if err != nil {
return xerrors.Errorf("failed to write host length: %w", err)
Expand All@@ -303,6 +305,7 @@ func addXauthEntry(ctx context.Context, fs afero.Fs, host string, display string
return xerrors.Errorf("failed to write host: %w", err)
}

// #nosec G115 - Safe conversion for display name length which is expected to be within uint16 range
err = binary.Write(file, binary.BigEndian, uint16(len(display)))
if err != nil {
return xerrors.Errorf("failed to write display length: %w", err)
Expand All@@ -312,6 +315,7 @@ func addXauthEntry(ctx context.Context, fs afero.Fs, host string, display string
return xerrors.Errorf("failed to write display: %w", err)
}

// #nosec G115 - Safe conversion for auth protocol length which is expected to be within uint16 range
err = binary.Write(file, binary.BigEndian, uint16(len(authProtocol)))
if err != nil {
return xerrors.Errorf("failed to write auth protocol length: %w", err)
Expand All@@ -321,6 +325,7 @@ func addXauthEntry(ctx context.Context, fs afero.Fs, host string, display string
return xerrors.Errorf("failed to write auth protocol: %w", err)
}

// #nosec G115 - Safe conversion for auth cookie length which is expected to be within uint16 range
err = binary.Write(file, binary.BigEndian, uint16(len(authCookieBytes)))
if err != nil {
return xerrors.Errorf("failed to write auth cookie length: %w", err)
Expand Down
4 changes: 2 additions & 2 deletionsagent/apphealth.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -167,8 +167,8 @@ func shouldStartTicker(app codersdk.WorkspaceApp) bool {
return app.Healthcheck.URL != "" && app.Healthcheck.Interval > 0 && app.Healthcheck.Threshold > 0
}

func healthChanged(old map[uuid.UUID]codersdk.WorkspaceAppHealth,new map[uuid.UUID]codersdk.WorkspaceAppHealth) bool {
for name, newValue := rangenew {
func healthChanged(old map[uuid.UUID]codersdk.WorkspaceAppHealth,updated map[uuid.UUID]codersdk.WorkspaceAppHealth) bool {
for name, newValue := rangeupdated {
oldValue, found := old[name]
if !found {
return true
Expand Down
7 changes: 4 additions & 3 deletionsagent/metrics.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -89,21 +89,22 @@ func (a *agent) collectMetrics(ctx context.Context) []*proto.Stats_Metric {
for _, metric := range metricFamily.GetMetric() {
labels := toAgentMetricLabels(metric.Label)

if metric.Counter != nil {
switch {
case metric.Counter != nil:
collected = append(collected, &proto.Stats_Metric{
Name: metricFamily.GetName(),
Type: proto.Stats_Metric_COUNTER,
Value: metric.Counter.GetValue(),
Labels: labels,
})
} else ifmetric.Gauge != nil {
casemetric.Gauge != nil:
collected = append(collected, &proto.Stats_Metric{
Name: metricFamily.GetName(),
Type: proto.Stats_Metric_GAUGE,
Value: metric.Gauge.GetValue(),
Labels: labels,
})
} else {
default:
a.logger.Error(ctx, "unsupported metric type", slog.F("type", metricFamily.Type.String()))
}
}
Expand Down
5 changes: 3 additions & 2 deletionsagent/reconnectingpty/buffered.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,6 +60,7 @@ func newBuffered(ctx context.Context, logger slog.Logger, execer agentexec.Exece
// Add TERM then start the command with a pty. pty.Cmd duplicates Path as the
// first argument so remove it.
cmdWithEnv := execer.PTYCommandContext(ctx, cmd.Path, cmd.Args[1:]...)
//nolint:gocritic
cmdWithEnv.Env = append(rpty.command.Env, "TERM=xterm-256color")
cmdWithEnv.Dir = rpty.command.Dir
ptty, process, err := pty.Start(cmdWithEnv)
Expand DownExpand Up@@ -236,7 +237,7 @@ func (rpty *bufferedReconnectingPTY) Wait() {
_, _ = rpty.state.waitForState(StateClosing)
}

func (rpty *bufferedReconnectingPTY) Close(error error) {
func (rpty *bufferedReconnectingPTY) Close(err error) {
// The closing state change will be handled by the lifecycle.
rpty.state.setState(StateClosing,error)
rpty.state.setState(StateClosing,err)
}
2 changes: 2 additions & 0 deletionsagent/reconnectingpty/screen.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -225,6 +225,7 @@ func (rpty *screenReconnectingPTY) doAttach(ctx context.Context, conn net.Conn,
rpty.command.Path,
// pty.Cmd duplicates Path as the first argument so remove it.
}, rpty.command.Args[1:]...)...)
//nolint:gocritic
cmd.Env = append(rpty.command.Env, "TERM=xterm-256color")
cmd.Dir = rpty.command.Dir
ptty, process, err := pty.Start(cmd, pty.WithPTYOption(
Expand DownExpand Up@@ -340,6 +341,7 @@ func (rpty *screenReconnectingPTY) sendCommand(ctx context.Context, command stri
// -X runs a command in the matching session.
"-X", command,
)
//nolint:gocritic
cmd.Env = append(rpty.command.Env, "TERM=xterm-256color")
cmd.Dir = rpty.command.Dir
cmd.Stdout = &stdout
Expand Down
4 changes: 2 additions & 2 deletionsapiversion/apiversion.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,10 +10,10 @@ import (

// New returns an *APIVersion with the given major.minor and
// additional supported major versions.
func New(maj,min int) *APIVersion {
func New(maj,minor int) *APIVersion {
v := &APIVersion{
supportedMajor: maj,
supportedMinor:min,
supportedMinor:minor,
additionalMajors: make([]int, 0),
}
return v
Expand Down
10 changes: 6 additions & 4 deletionscli/agent.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -127,6 +127,7 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
logger.Info(ctx, "spawning reaper process")
// Do not start a reaper on the child process. It's important
// to do this else we fork bomb ourselves.
//nolint:gocritic
args := append(os.Args, "--no-reap")
err := reaper.ForkReap(
reaper.WithExecArgs(args...),
Expand DownExpand Up@@ -327,10 +328,11 @@ func (r *RootCmd) workspaceAgent() *serpent.Command {
}

agnt := agent.New(agent.Options{
Client: client,
Logger: logger,
LogDir: logDir,
ScriptDataDir: scriptDataDir,
Client: client,
Logger: logger,
LogDir: logDir,
ScriptDataDir: scriptDataDir,
// #nosec G115 - Safe conversion as tailnet listen port is within uint16 range (0-65535)
TailnetListenPort: uint16(tailnetListenPort),
ExchangeToken: func(ctx context.Context) (string, error) {
if exchangeToken == nil {
Expand Down
1 change: 1 addition & 0 deletionscli/clistat/disk.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,6 +19,7 @@ func (*Statter) Disk(p Prefix, path string) (*Result, error) {
return nil, err
}
var r Result
// #nosec G115 - Safe conversion because stat.Bsize is always positive and within uint64 range
r.Total = ptr.To(float64(stat.Blocks * uint64(stat.Bsize)))
r.Used = float64(stat.Blocks-stat.Bfree) * float64(stat.Bsize)
r.Unit = "B"
Expand Down
1 change: 1 addition & 0 deletionscli/clitest/golden.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,6 +58,7 @@ func TestCommandHelp(t *testing.T, getRoot func(t *testing.T) *serpent.Command,
ExtractCommandPathsLoop:
for _, cp := range extractVisibleCommandPaths(nil, root.Children) {
name := fmt.Sprintf("coder %s --help", strings.Join(cp, " "))
//nolint:gocritic
cmd := append(cp, "--help")
for _, tt := range cases {
if tt.Name == name {
Expand Down
2 changes: 1 addition & 1 deletioncli/cliui/cliui.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@ import (
"github.com/coder/pretty"
)

varCanceled = xerrors.New("canceled")
varErrCanceled = xerrors.New("canceled")

// DefaultStyles compose visual elements of the UI.
var DefaultStyles Styles
Expand Down
7 changes: 4 additions & 3 deletionscli/cliui/parameter.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,8 @@ func RichParameter(inv *serpent.Invocation, templateVersionParameter codersdk.Te

var err error
var value string
if templateVersionParameter.Type == "list(string)" {
switch {
case templateVersionParameter.Type == "list(string)":
// Move the cursor up a single line for nicer display!
_, _ = fmt.Fprint(inv.Stdout, "\033[1A")

Expand All@@ -60,7 +61,7 @@ func RichParameter(inv *serpent.Invocation, templateVersionParameter codersdk.Te
)
value = string(v)
}
} else iflen(templateVersionParameter.Options) > 0 {
caselen(templateVersionParameter.Options) > 0:
// Move the cursor up a single line for nicer display!
_, _ = fmt.Fprint(inv.Stdout, "\033[1A")
var richParameterOption *codersdk.TemplateVersionParameterOption
Expand All@@ -74,7 +75,7 @@ func RichParameter(inv *serpent.Invocation, templateVersionParameter codersdk.Te
pretty.Fprintf(inv.Stdout, DefaultStyles.Prompt, "%s\n", richParameterOption.Name)
value = richParameterOption.Value
}
} else {
default:
text := "Enter a value"
if !templateVersionParameter.Required {
text += fmt.Sprintf(" (default: %q)", defaultValue)
Expand Down
4 changes: 2 additions & 2 deletionscli/cliui/prompt.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -124,7 +124,7 @@ func Prompt(inv *serpent.Invocation, opts PromptOptions) (string, error) {
return "", err
case line := <-lineCh:
if opts.IsConfirm && line != "yes" && line != "y" {
return line, xerrors.Errorf("got %q: %w", line,Canceled)
return line, xerrors.Errorf("got %q: %w", line,ErrCanceled)
}
if opts.Validate != nil {
err := opts.Validate(line)
Expand All@@ -139,7 +139,7 @@ func Prompt(inv *serpent.Invocation, opts PromptOptions) (string, error) {
case <-interrupt:
// Print a newline so that any further output starts properly on a new line.
_, _ = fmt.Fprintln(inv.Stdout)
return "",Canceled
return "",ErrCanceled
}
}

Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp