Skip to content
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
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ jobs:
test:
strategy:
matrix:
go: ["1.13.x", "1.14.x", "1.15.x"]
go: ["1.18.x", "1.19.x"]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go ${{ matrix.go }}
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Test
run: go test -v ./...
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- 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.23.8 golangci-lint run --disable-all -v \
-E govet -E misspell -E gofmt -E ineffassign -E golint
golangci/golangci-lint:v1.50.1 golangci-lint run --disable-all -v \
-E govet -E misspell -E gofmt -E ineffassign -E revive
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
module github.com/moby/term

go 1.13
go 1.18

require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1
github.com/creack/pty v1.1.11
github.com/google/go-cmp v0.4.0
github.com/pkg/errors v0.9.1 // indirect
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22
gotest.tools/v3 v3.0.2
)

require github.com/pkg/errors v0.9.1 // indirect
1 change: 1 addition & 0 deletions tc.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows

package term
Expand Down
7 changes: 3 additions & 4 deletions term.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows

// Package term provides structures and helper functions to work with
Expand All @@ -14,10 +15,8 @@ import (
"golang.org/x/sys/unix"
)

var (
// ErrInvalidState is returned if the state of the terminal is invalid.
ErrInvalidState = errors.New("Invalid terminal state")
)
// ErrInvalidState is returned if the state of the terminal is invalid.
var ErrInvalidState = errors.New("Invalid terminal state")

// State represents the state of the terminal.
type State struct {
Expand Down
4 changes: 2 additions & 2 deletions term_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//go:build !windows
// +build !windows

package term

import (
"io/ioutil"
"os"
"testing"

Expand All @@ -23,7 +23,7 @@ func newTtyForTest(t *testing.T) (*os.File, *os.File) {
}

func newTempFile() (*os.File, error) {
return ioutil.TempFile(os.TempDir(), "temp")
return os.CreateTemp(os.TempDir(), "temp")
}

func TestGetWinsize(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions termios.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows

package term
Expand Down
1 change: 1 addition & 0 deletions termios_bsd.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build darwin || freebsd || openbsd || netbsd
// +build darwin freebsd openbsd netbsd

package term
Expand Down
3 changes: 2 additions & 1 deletion termios_nonbsd.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build !darwin,!freebsd,!netbsd,!openbsd,!windows
//go:build !darwin && !freebsd && !netbsd && !openbsd && !windows
// +build !darwin,!freebsd,!netbsd,!openbsd,!windows

package term

Expand Down
2 changes: 1 addition & 1 deletion windows/ansi_reader.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build windows
// +build windows

package windowsconsole
Expand Down Expand Up @@ -190,7 +191,6 @@ func keyToString(keyEvent *winterm.KEY_EVENT_RECORD, escapeSequence []byte) stri
// <Ctrl>-S Suspends printing on the screen (does not stop the program).
// <Ctrl>-U Deletes all characters on the current line. Also called the KILL key.
// <Ctrl>-E Quits current command and creates a core

}

// <Alt>+Key generates ESC N Key
Expand Down
1 change: 1 addition & 0 deletions windows/ansi_writer.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build windows
// +build windows

package windowsconsole
Expand Down
1 change: 1 addition & 0 deletions windows/console.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build windows
// +build windows

package windowsconsole
Expand Down
1 change: 1 addition & 0 deletions winsize.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows

package term
Expand Down