Skip to content

Commit

Permalink
Code cleaned, CI +go1.21, -go1.18 (#45)
Browse files Browse the repository at this point in the history
CI updated
`enumerator` package has been deleted
It's quite old and does not build with go1.21.
Use the `github.com/bugst/go-serial/enumerator` as it the root source of the removed package and maintained well.
  • Loading branch information
albenik authored Jan 28, 2024
1 parent bbd0159 commit 594ef15
Show file tree
Hide file tree
Showing 22 changed files with 93 additions and 1,115 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ ij_go_move_all_stdlib_imports_in_one_group = true
ij_go_local_group_mode = project
ij_go_GROUP_CURRENT_PROJECT_IMPORTS = true

[*.{yml, yaml}]
[*.{yml,yaml}]
indent_style = space
indent_size = 2
60 changes: 22 additions & 38 deletions .github/workflows/golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,18 @@ jobs:
- 'macos-latest'
- 'windows-latest'
go:
- '1.18'
- '1.19'
- '1.20'
- '1.21'

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Go
uses: actions/setup-go@v2
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}

- name: Get dependencies
run: go mod download

- name: Test
run: go test -v -race ./...
- run: go test -v -race ./...

# Lint
# lint:
Expand Down Expand Up @@ -69,47 +61,39 @@ jobs:
matrix:
# `go tool dist list` with many exclusions
include:
- { os: ubuntu-latest, goos: linux, goarch: amd64 }
- { os: ubuntu-latest, goos: linux, goarch: arm64 }
- { os: ubuntu-latest, goos: linux, goarch: ppc64le }
- { os: ubuntu-latest, goos: linux, goarch: amd64, cgo: '0' }
- { os: ubuntu-latest, goos: linux, goarch: arm64, cgo: '0' }
- { os: ubuntu-latest, goos: linux, goarch: ppc64le, cgo: '0' }

- { os: ubuntu-latest, goos: android, goarch: amd64 }
- { os: ubuntu-latest, goos: android, goarch: arm64 }
- { os: ubuntu-latest, goos: android, goarch: amd64, cgo: '0' }
- { os: ubuntu-latest, goos: android, goarch: arm64, cgo: '0' }

- { os: ubuntu-latest, goos: freebsd, goarch: amd64 }
- { os: ubuntu-latest, goos: freebsd, goarch: arm64 }
- { os: ubuntu-latest, goos: freebsd, goarch: amd64, cgo: '0' }
- { os: ubuntu-latest, goos: freebsd, goarch: arm64, cgo: '0' }

- { os: ubuntu-latest, goos: openbsd, goarch: amd64 }
- { os: ubuntu-latest, goos: openbsd, goarch: arm64 }
- { os: ubuntu-latest, goos: openbsd, goarch: amd64, cgo: '0' }
- { os: ubuntu-latest, goos: openbsd, goarch: arm64, cgo: '0' }

# MacOS IOKit required, so no cross-build available
# - { os: ubuntu-latest, goos: darwin, goarch: amd64 }
# - { os: ubuntu-latest, goos: darwin, goarch: arm64 }

- { os: macos-latest, goos: darwin, goarch: amd64 }
# Currently `macos-latest` is equeal to `macos-11` which does not support arm64
# - { os: macos-latest, goos: darwin, goarch: arm64 }
- { os: macos-latest, goos: darwin, goarch: amd64, cgo: '1' }
- { os: macos-latest, goos: darwin, goarch: arm64, cgo: '1' }

- { os: windows-latest, goos: windows, goarch: amd64 }
- { os: windows-latest, goos: windows, goarch: arm64 }
- { os: windows-latest, goos: windows, goarch: amd64, cgo: '0' }
- { os: windows-latest, goos: windows, goarch: arm64, cgo: '0' }

runs-on: ${{ matrix.os }}

env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: ${{ matrix.cgo }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Get dependencies
run: go mod download

- name: Build
run: go build
go-version: '1.21'
- run: uname -a && go build
14 changes: 7 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,29 @@ linters:
# Please keep in order
disable:
- deadcode # The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
- exhaustruct # Unecessary annoying!
- exhaustivestruct # Unecessary annoying!
- exhaustruct # Unnecessary annoying!
- exhaustivestruct # Unnecessary annoying!
- goerr113 # Useful but not in this package!
- gochecknoglobals # Too paranoic!
- goimports # Latest gci with sections is good enougth
- gochecknoglobals # Too paranoid!
- goimports # Latest gci with sections is good enough
- golint # The linter 'golint' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive.
- ifshort # The linter 'ifshort' is deprecated (since v1.48.0) due to: The repository of the linter has been deprecated by the owner.
- interfacer # The linter 'interfacer' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner.
- ireturn # Yes! Some functions retures interfaces.
- ireturn # Yes! Some functions returns interfaces.
- maligned # The linter 'maligned' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner. Replaced by govet 'fieldalignment'.
- nlreturn # Personally I hate mandatory blank lines before returns.
- nosnakecase # The linter 'nosnakecase' is deprecated (since v1.48.1) due to: The repository of the linter has been deprecated by the owner. Replaced by revive(var-naming).
- paralleltest
- rowserrcheck # rowserrcheck is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649.
- scopelint # The linter 'scopelint' is deprecated (since v1.39.0) due to: The repository of the linter has been deprecated by the owner. Replaced by exportloopref.
- structcheck # structcheck is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649.
- testableexamples # New linetr, project is not adapted for this linter yet.
- testableexamples # New linter, project is not adapted for this linter yet.
- varcheck # The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
- varnamelen # Annoying!
- unparam # Panics with GOOS=linux
- wastedassign # wastedassign is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649.
- wrapcheck # Not needed!
- wsl # Unecessary annoying!
- wsl # Unnecessary annoying!

issues:
exclude-rules:
Expand Down
65 changes: 39 additions & 26 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,68 @@
# Changelog

## 2.7.0

- CI: Supported go versions now are `go1.19`, `go1.20`, `go1.21`
- Applied `go mod tidy -go 1.19`
- Package `github.com/albenik/go-serial/enumerator` was removed as of broken build with `go1.21`,
please use `github.com/bugst/go-serial/enumerator` — the original well maintained source of the removed package.
- Minor code fixes (typo, linter recommendations, etc...)
- Dependencies updated

## 2.6.1

- BUGFIX: Linux, "bad address" while setting DTR (#41)

## 2.6.0

* `go mod tudy -go 1.18`.
* CI Tests: `go1.18`, `go1.19`, `go1.20`.
* CI Cross-build: cleanup.
* `golangci-lint` added & code cleaned.
* obsolete `darwin/386` code removed.
- `go mod tudy -go 1.18`.
- CI Tests: `go1.18`, `go1.19`, `go1.20`.
- CI Cross-build: cleanup.
- `golangci-lint` added & code cleaned.
- obsolete `darwin/386` code removed.

## 2.5.1

* `ppc64le` build supported [#33](https://github.com/albenik/go-serial/pull/33).
- `ppc64le` build supported [#33](https://github.com/albenik/go-serial/pull/33).

## 2.5.0

* `GOOS=android` build supported [#29](https://github.com/albenik/go-serial/issues/29).
* Unused second argument for unix build in method `Port.SetTimeoutEx()` was made optional in backward compatibility
- `GOOS=android` build supported [#29](https://github.com/albenik/go-serial/issues/29).
- Unused second argument for unix build in method `Port.SetTimeoutEx()` was made optional in backward compatibility
manner.
* `go 1.13` errors supported: `PortError.Unwrap()` method added, `PortError.Cause()` method marked as deprecated.
- `go 1.13` errors supported: `PortError.Unwrap()` method added, `PortError.Cause()` method marked as deprecated.

## 2.4.0

* `GOOS=darwin GOARCH=arm64` build supported [#25](https://github.com/albenik/go-serial/pull/25).
* Fixed regression in `GOOS=darwin` build was introduced in `v2.3.0`
- `GOOS=darwin GOARCH=arm64` build supported [#25](https://github.com/albenik/go-serial/pull/25).
- Fixed regression in `GOOS=darwin` build was introduced in `v2.3.0`

## 2.3.0

* Some fixes backported from https://github.com/bugst/go-serial [#22](https://github.com/albenik/go-serial/pull/22).
- Some fixes backported from https://github.com/bugst/go-serial [#22](https://github.com/albenik/go-serial/pull/22).

## 2.2.0

* `PortError.Cause()` method added
- `PortError.Cause()` method added

## 2.1.0

* MacOS extended baudrate support added [#14](https://github.com/albenik/go-serial/pull/14).
* MacOS wrong generated syscall fixed [#15](https://github.com/albenik/go-serial/issues/15).
- MacOS extended baudrate support added [#14](https://github.com/albenik/go-serial/pull/14).
- MacOS wrong generated syscall fixed [#15](https://github.com/albenik/go-serial/issues/15).

## 2.0.0

* New Go Module import path `github.com/albenik/go-serial/v2`
* `serial.Port` interface discarded in favor of `serial.Port` structure (similar to `os.File`)
* `serial.Mode` discared and replaced with `serial.Option`
* `serial.Open()` method changed to use `serila.Option`)
* `port.SetMode(mode *Mode)` replaced with `port.Reconfigure(opts ...Option)`
* `Disable HUPCL by default` [#7](https://github.com/albenik/go-serial/pull/7)
* `WithHUPCL(bool)` option introduced
* Minor bugfix & refactoring
- New Go Module import path `github.com/albenik/go-serial/v2`
- `serial.Port` interface discarded in favor of `serial.Port` structure (similar to `os.File`)
- `serial.Mode` discarded and replaced with `serial.Option`
- `serial.Open()` method changed to use `serila.Option`)
- `port.SetMode(mode *Mode)` replaced with `port.Reconfigure(opts ...Option)`
- `Disable HUPCL by default` [#7](https://github.com/albenik/go-serial/pull/7)
- `WithHUPCL(bool)` option introduced
- Minor bugfix & refactoring

## 1.x.x

* Forked from https://github.com/bugst/go-serial
* Minor but incompatible interface & logic changes implemented
* Import path altered
- Forked from https://github.com/bugst/go-serial
- Minor but incompatible interface & logic changes implemented
- Import path altered
20 changes: 0 additions & 20 deletions enumerator/doc.go

This file was deleted.

43 changes: 0 additions & 43 deletions enumerator/enumerator.go

This file was deleted.

32 changes: 0 additions & 32 deletions enumerator/example_getdetailedportlist_test.go

This file was deleted.

9 changes: 0 additions & 9 deletions enumerator/syscall_windows.go

This file was deleted.

Loading

0 comments on commit 594ef15

Please sign in to comment.