Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gha: update actions/setup-go@v5, actions/checkout@v4, golangci-lint to v1.62.2, test against go1.22, go1.23 (latest, latest -1) #46

Merged
merged 6 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 9 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,31 @@ jobs:
test:
strategy:
matrix:
go: ["1.18.x", "1.19.x", "1.20.x"]
go: ["1.18.x", "1.22.x", "1.23.x"]
platform: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go ${{ matrix.go }}
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Test
run: go test -v ./...
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: go mod tidy
run: |
go mod tidy
git diff --exit-code
- name: Lint
run: |
docker run --rm -v `pwd`:/go/src/github.com/moby/term -w /go/src/github.com/moby/term \
golangci/golangci-lint:v1.50.1 golangci-lint run --disable-all -v \
-E govet -E misspell -E gofmt -E ineffassign -E revive
docker run --rm -v ./:/go/src/github.com/moby/term -w /go/src/github.com/moby/term \
golangci/golangci-lint:v1.62.2 golangci-lint run -v \
-E gofmt \
-E misspell \
-E revive
30 changes: 17 additions & 13 deletions term_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,33 +86,33 @@ func TestSetWinsize(t *testing.T) {

func TestGetFdInfo(t *testing.T) {
tty := newTTYForTest(t)
inFd, isTerminal := GetFdInfo(tty)
inFd, isTerm := GetFdInfo(tty)
if inFd != tty.Fd() {
t.Errorf("expected: %d, got: %d", tty.Fd(), inFd)
}
if !isTerminal {
t.Error("expected isTerminal to be true")
if !isTerm {
t.Error("expected file-descriptor to be a terminal")
}
tmpFile := newTempFile(t)
inFd, isTerminal = GetFdInfo(tmpFile)
inFd, isTerm = GetFdInfo(tmpFile)
if inFd != tmpFile.Fd() {
t.Errorf("expected: %d, got: %d", tty.Fd(), inFd)
}
if isTerminal {
t.Error("expected isTerminal to be false")
if isTerm {
t.Error("expected file-descriptor to not be a terminal")
}
}

func TestIsTerminal(t *testing.T) {
tty := newTTYForTest(t)
isTerminal := IsTerminal(tty.Fd())
if !isTerminal {
t.Fatalf("expected isTerminal to be true")
isTerm := IsTerminal(tty.Fd())
if !isTerm {
t.Error("expected file-descriptor to be a terminal")
}
tmpFile := newTempFile(t)
isTerminal = IsTerminal(tmpFile.Fd())
if isTerminal {
t.Fatalf("expected isTerminal to be false")
isTerm = IsTerminal(tmpFile.Fd())
if isTerm {
t.Error("expected file-descriptor to not be a terminal")
}
}

Expand All @@ -135,7 +135,11 @@ func TestSaveState(t *testing.T) {
func TestDisableEcho(t *testing.T) {
tty := newTTYForTest(t)
state, err := SetRawTerminal(tty.Fd())
defer RestoreTerminal(tty.Fd(), state)
defer func() {
if err := RestoreTerminal(tty.Fd(), state); err != nil {
t.Error(err)
}
}()
if err != nil {
t.Error(err)
}
Expand Down
2 changes: 1 addition & 1 deletion term_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func setRawTerminal(fd uintptr) (*State, error) {
return makeRaw(fd)
}

func setRawTerminalOutput(fd uintptr) (*State, error) {
func setRawTerminalOutput(uintptr) (*State, error) {
return nil, nil
}

Expand Down
Loading