Skip to content

Commit

Permalink
Update golang version
Browse files Browse the repository at this point in the history
  • Loading branch information
outdead committed Feb 3, 2024
1 parent 40b5033 commit d09136e
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 37 deletions.
64 changes: 32 additions & 32 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
66 changes: 66 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
# <name> <type> (<type> can also be a pointer/slice/map/chan/...)
# - for constants: const <name>
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:
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/gorcon/telnet

go 1.15
go 1.21
6 changes: 3 additions & 3 deletions telnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit d09136e

Please sign in to comment.