Skip to content

Commit b19df2d

Browse files
Merge pull request #25740 from Luap99/deps-removal
remove github.com/buger/goterm and github.com/google/gofuzz dependency
2 parents 3dbc3f2 + 8ef234a commit b19df2d

File tree

25 files changed

+22
-2168
lines changed

25 files changed

+22
-2168
lines changed

cmd/podman/common/term.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package common
2+
3+
import (
4+
"os"
5+
6+
"golang.org/x/term"
7+
)
8+
9+
// ClearScreen clears the screen and puts the cursor back to position 1,1
10+
// Useful when printing output in an interval like podman stats.
11+
// When the stdout is not a terminal this is a NOP.
12+
func ClearScreen() {
13+
// Only write escape sequences when the output is a terminal.
14+
if term.IsTerminal(int(os.Stdout.Fd())) {
15+
// terminal escape control sequence to clear screen ([2J)
16+
// followed by putting the cursor to position 1,1 ([1;1H)
17+
os.Stdout.WriteString("\033[2J\033[1;1H")
18+
}
19+
}

cmd/podman/containers/ps.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"strings"
1111
"time"
1212

13-
tm "github.com/buger/goterm"
1413
"github.com/containers/common/libnetwork/types"
1514
"github.com/containers/common/pkg/completion"
1615
"github.com/containers/common/pkg/report"
@@ -267,9 +266,7 @@ func ps(cmd *cobra.Command, _ []string) error {
267266
responses = append(responses, psReporter{r})
268267
}
269268

270-
tm.Clear()
271-
tm.MoveCursor(1, 1)
272-
tm.Flush()
269+
common.ClearScreen()
273270

274271
if err := headers(); err != nil {
275272
return err

cmd/podman/containers/stats.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"os"
77
"strconv"
88

9-
tm "github.com/buger/goterm"
109
"github.com/containers/common/pkg/completion"
1110
"github.com/containers/common/pkg/report"
1211
"github.com/containers/podman/v5/cmd/podman/common"
@@ -152,9 +151,7 @@ func outputStats(cmd *cobra.Command, reports []define.ContainerStats) error {
152151
"PIDS": "PIDS",
153152
})
154153
if !statsOptions.NoReset {
155-
tm.Clear()
156-
tm.MoveCursor(1, 1)
157-
tm.Flush()
154+
common.ClearScreen()
158155
}
159156
stats := make([]containerStats, 0, len(reports))
160157
for _, r := range reports {

cmd/podman/pods/stats.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"os"
77
"time"
88

9-
"github.com/buger/goterm"
109
"github.com/containers/common/pkg/report"
1110
"github.com/containers/podman/v5/cmd/podman/common"
1211
"github.com/containers/podman/v5/cmd/podman/registry"
@@ -93,9 +92,7 @@ func stats(cmd *cobra.Command, args []string) error {
9392
err = printJSONPodStats(reports)
9493
} else {
9594
if !statsOptions.NoReset {
96-
goterm.Clear()
97-
goterm.MoveCursor(1, 1)
98-
goterm.Flush()
95+
common.ClearScreen()
9996
}
10097
if report.OriginUser == rpt.Origin {
10198
err = userTemplate(rpt, reports)

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ require (
99
github.com/BurntSushi/toml v1.5.0
1010
github.com/Microsoft/go-winio v0.6.2
1111
github.com/blang/semver/v4 v4.0.0
12-
github.com/buger/goterm v1.0.4
1312
github.com/checkpoint-restore/checkpointctl v1.3.0
1413
github.com/checkpoint-restore/go-criu/v7 v7.2.0
1514
github.com/containernetworking/plugins v1.6.2
@@ -33,7 +32,6 @@ require (
3332
github.com/docker/go-plugins-helpers v0.0.0-20240701071450-45e2431495c8
3433
github.com/docker/go-units v0.5.0
3534
github.com/godbus/dbus/v5 v5.1.1-0.20241109141217-c266b19b28e9
36-
github.com/google/gofuzz v1.2.0
3735
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
3836
github.com/google/uuid v1.6.0
3937
github.com/gorilla/handlers v1.5.2

go.sum

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
2828
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
2929
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
3030
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
31-
github.com/buger/goterm v1.0.4 h1:Z9YvGmOih81P0FbVtEYTFF6YsSgxSUKEhf/f9bTMXbY=
32-
github.com/buger/goterm v1.0.4/go.mod h1:HiFWV3xnkolgrBV3mY8m0X0Pumt4zg4QhbdOzQtB8tE=
3331
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
3432
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
3533
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
@@ -225,8 +223,6 @@ github.com/google/go-containerregistry v0.20.3/go.mod h1:w00pIgBRDVUDFM6bq+Qx8lw
225223
github.com/google/go-intervals v0.0.2 h1:FGrVEiUnTRKR8yE04qzXYaJMtnIYqobR5QbblK3ixcM=
226224
github.com/google/go-intervals v0.0.2/go.mod h1:MkaR3LNRfeKLPmqgJYs4E66z5InYjmCjbbr4TQlcT6Y=
227225
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
228-
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
229-
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
230226
github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 h1:CVuJwN34x4xM2aT4sIKhmeib40NeBPhRihNjQmpJsA4=
231227
github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2/go.mod h1:nOFQdrUlIlx6M6ODdSpBj1NVA+VgLC6kmw60mkw34H4=
232228
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg=
@@ -607,7 +603,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w
607603
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
608604
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
609605
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
610-
golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
611606
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
612607
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
613608
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

pkg/k8s.io/apimachinery/pkg/util/intstr/instr_fuzz.go

Lines changed: 0 additions & 42 deletions
This file was deleted.

vendor/github.com/buger/goterm/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

vendor/github.com/buger/goterm/LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

vendor/github.com/buger/goterm/README.md

Lines changed: 0 additions & 119 deletions
This file was deleted.

0 commit comments

Comments
 (0)