Skip to content

Commit e3559a6

Browse files
authored
Merge pull request #46 from thaJeztah/refresh_gha
gha: update actions/setup-go@v5, actions/checkout@v4, golangci-lint to v1.62.2, test against go1.22, go1.23 (latest, latest -1)
2 parents 9c3c875 + a86f033 commit e3559a6

File tree

3 files changed

+27
-21
lines changed

3 files changed

+27
-21
lines changed

.github/workflows/test.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,31 @@ jobs:
44
test:
55
strategy:
66
matrix:
7-
go: ["1.18.x", "1.19.x", "1.20.x"]
7+
go: ["1.18.x", "1.22.x", "1.23.x"]
88
platform: [ubuntu-latest, windows-latest, macos-latest]
99
runs-on: ${{ matrix.platform }}
1010
steps:
1111
- name: Install Go ${{ matrix.go }}
12-
uses: actions/setup-go@v4
12+
uses: actions/setup-go@v5
1313
with:
1414
go-version: ${{ matrix.go }}
1515
- name: Checkout code
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717
- name: Test
1818
run: go test -v ./...
1919
lint:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Checkout code
23-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
2424
- name: go mod tidy
2525
run: |
2626
go mod tidy
2727
git diff --exit-code
2828
- name: Lint
2929
run: |
30-
docker run --rm -v `pwd`:/go/src/github.com/moby/term -w /go/src/github.com/moby/term \
31-
golangci/golangci-lint:v1.50.1 golangci-lint run --disable-all -v \
32-
-E govet -E misspell -E gofmt -E ineffassign -E revive
30+
docker run --rm -v ./:/go/src/github.com/moby/term -w /go/src/github.com/moby/term \
31+
golangci/golangci-lint:v1.62.2 golangci-lint run -v \
32+
-E gofmt \
33+
-E misspell \
34+
-E revive

term_test.go

+17-13
Original file line numberDiff line numberDiff line change
@@ -86,33 +86,33 @@ func TestSetWinsize(t *testing.T) {
8686

8787
func TestGetFdInfo(t *testing.T) {
8888
tty := newTTYForTest(t)
89-
inFd, isTerminal := GetFdInfo(tty)
89+
inFd, isTerm := GetFdInfo(tty)
9090
if inFd != tty.Fd() {
9191
t.Errorf("expected: %d, got: %d", tty.Fd(), inFd)
9292
}
93-
if !isTerminal {
94-
t.Error("expected isTerminal to be true")
93+
if !isTerm {
94+
t.Error("expected file-descriptor to be a terminal")
9595
}
9696
tmpFile := newTempFile(t)
97-
inFd, isTerminal = GetFdInfo(tmpFile)
97+
inFd, isTerm = GetFdInfo(tmpFile)
9898
if inFd != tmpFile.Fd() {
9999
t.Errorf("expected: %d, got: %d", tty.Fd(), inFd)
100100
}
101-
if isTerminal {
102-
t.Error("expected isTerminal to be false")
101+
if isTerm {
102+
t.Error("expected file-descriptor to not be a terminal")
103103
}
104104
}
105105

106106
func TestIsTerminal(t *testing.T) {
107107
tty := newTTYForTest(t)
108-
isTerminal := IsTerminal(tty.Fd())
109-
if !isTerminal {
110-
t.Fatalf("expected isTerminal to be true")
108+
isTerm := IsTerminal(tty.Fd())
109+
if !isTerm {
110+
t.Error("expected file-descriptor to be a terminal")
111111
}
112112
tmpFile := newTempFile(t)
113-
isTerminal = IsTerminal(tmpFile.Fd())
114-
if isTerminal {
115-
t.Fatalf("expected isTerminal to be false")
113+
isTerm = IsTerminal(tmpFile.Fd())
114+
if isTerm {
115+
t.Error("expected file-descriptor to not be a terminal")
116116
}
117117
}
118118

@@ -135,7 +135,11 @@ func TestSaveState(t *testing.T) {
135135
func TestDisableEcho(t *testing.T) {
136136
tty := newTTYForTest(t)
137137
state, err := SetRawTerminal(tty.Fd())
138-
defer RestoreTerminal(tty.Fd(), state)
138+
defer func() {
139+
if err := RestoreTerminal(tty.Fd(), state); err != nil {
140+
t.Error(err)
141+
}
142+
}()
139143
if err != nil {
140144
t.Error(err)
141145
}

term_unix.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func setRawTerminal(fd uintptr) (*State, error) {
8181
return makeRaw(fd)
8282
}
8383

84-
func setRawTerminalOutput(fd uintptr) (*State, error) {
84+
func setRawTerminalOutput(uintptr) (*State, error) {
8585
return nil, nil
8686
}
8787

0 commit comments

Comments
 (0)