diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fb8f438..e7c0ee9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,35 +15,35 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - name: Set up Go 1.x - uses: actions/setup-go@v2 - with: - go-version: ^1.15 - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - - name: Lint - uses: golangci/golangci-lint-action@v2 - with: - # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.33 - - # Optional: working directory, useful for monorepos - # working-directory: somedir - - # Optional: golangci-lint command line arguments. - # args: --issues-exit-code=0 - args: --config=.golangci.yml - - # Optional: show only new issues if it's a pull request. The default value is `false`. - only-new-issues: false - - - name: Get dependencies - run: | - go get -v -t -d ./... - - name: Test - run: go test -v ./... - - - name: Build - run: go build -v . + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: 1.21.6 + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Lint + uses: golangci/golangci-lint-action@v2 + with: + # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. + version: v1.55.2 + + # Optional: working directory, useful for monorepos + # working-directory: somedir + + # Optional: golangci-lint command line arguments. + # args: --issues-exit-code=0 + args: --config=.golangci.yml + + # Optional: show only new issues if it's a pull request. The default value is `false`. + only-new-issues: false + + - name: Get dependencies + run: | + go get -v -t -d ./... + - name: Test + run: go test -v ./... + + - name: Build + run: go build -v . diff --git a/.golangci.yml b/.golangci.yml index a65ad48..2d058a2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -46,6 +46,8 @@ linters-settings: gocyclo: # minimal code complexity to report, 30 by default (but we recommend 10-20) min-complexity: 15 + cyclop: + max-complexity: 15 godox: keywords: - "BUG" @@ -116,10 +118,74 @@ linters-settings: allow-trailing-comment: true # Force newlines in end of case at this limit (0 = never). force-case-trailing-whitespace: 0 + varnamelen: + # The longest distance, in source lines, that is being considered a "small scope." (defaults to 5) + # Variables used in at most this many lines will be ignored. + max-distance: 5 + # The minimum length of a variable's name that is considered "long." (defaults to 3) + # Variable names that are at least this long will be ignored. + min-name-length: 3 + # Check method receivers. (defaults to false) + check-receiver: false + # Check named return values. (defaults to false) + check-return: false + # Check type parameters. (defaults to false) + check-type-param: false + # Ignore "ok" variables that hold the bool return value of a type assertion. (defaults to false) + ignore-type-assert-ok: false + # Ignore "ok" variables that hold the bool return value of a map index. (defaults to false) + ignore-map-index-ok: false + # Ignore "ok" variables that hold the bool return value of a channel receive. (defaults to false) + ignore-chan-recv-ok: false + # Optional list of variable names that should be ignored completely. (defaults to empty list) + ignore-names: + - err + # Optional list of variable declarations that should be ignored completely. (defaults to empty list) + # Entries must be in one of the following forms (see below for examples): + # - for variables, parameters, named return values, method receivers, or type parameters: + # ( can also be a pointer/slice/map/chan/...) + # - for constants: const + ignore-decls: + - t testing.T + - f *foo.Bar + - e error + - i int + - n int + - const C + - T any + - m map[string]int + - x int + - y int + - w io.Writer + - r io.Reader + - i int64 + - f *os.File + - m int + - n int64 + - i int32 + - c *Context linters: enable-all: true disable: + - interfacer # is deprecated (since v1.38.0) + - scopelint # is deprecated (since v1.39.0) + - golint # is deprecated (since v1.41.0) + - maligned # is deprecated (since v1.38.0) + - ifshort # is deprecated (since v1.48.0) + - deadcode # is deprecated (since v1.49.0) + - nosnakecase # is deprecated (since v1.48.1) + - varcheck # is deprecated (since v1.49.0) + - exhaustivestruct # is deprecated (since v1.46.0) + - structcheck # is deprecated (since v1.49.0) + - rowserrcheck # is disabled because of generics + - sqlclosecheck # is disabled because of generics + - structcheck # is disabled because of generics + - wastedassign # is disabled because of generics + - wrapcheck + - exhaustruct # mad linter + - depguard + - nonamedreturns issues: exclude: diff --git a/CHANGELOG.md b/CHANGELOG.md index d821e96..9cd3caf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +## [v1.2.3] - 2024-02-03 +### Updated +- Updated Golang to 1.21.6 version. +- Updated golangci linter to 1.55.2 version. + ## [v1.2.2] - 2021-01-06 ### Fixed - Fixed telnettest panic "handle read request error" @@ -46,7 +51,8 @@ job was joined with tests workflow. ### Added - Initial implementation. -[Unreleased]: https://github.com/gorcon/telnet/compare/v1.2.2...HEAD +[Unreleased]: https://github.com/gorcon/telnet/compare/v1.2.3...HEAD +[v1.2.3]: https://github.com/gorcon/telnet/compare/v1.2.2...v1.2.3 [v1.2.2]: https://github.com/gorcon/telnet/compare/v1.2.1...v1.2.2 [v1.2.1]: https://github.com/gorcon/telnet/compare/v1.2.0...v1.2.1 [v1.2.0]: https://github.com/gorcon/telnet/compare/v1.1.0...v1.2.0 diff --git a/go.mod b/go.mod index a74f722..a54fd4b 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/gorcon/telnet -go 1.15 +go 1.21 diff --git a/telnet.go b/telnet.go index 9347651..6adb909 100644 --- a/telnet.go +++ b/telnet.go @@ -268,17 +268,17 @@ func (c *Conn) read(p []byte) (n int, err error) { // processReadResponse reads response data from TELNET connection // and writes them to writer (Stdout). func (c *Conn) processReadResponse(writer io.Writer) { - p := make([]byte, 1) + packet := make([]byte, 1) for { // Read 1 byte. - n, err := c.read(p) + n, err := c.read(packet) if n <= 0 && err == nil { continue } else if n <= 0 && err != nil { break } - _, _ = writer.Write(p) + _, _ = writer.Write(packet) } }