Skip to content

Commit 08540b2

Browse files
authored
go 1.16 now is minimal supported version (see go.mod) (albenik#34)
* go.mod 'go 1.16' * ci: go1.16, go1.17, go1.18 * ci: build matrix cleanup * linter added & code cleaned * obsolete darwin/386 code removed
1 parent 8212fd6 commit 08540b2

28 files changed

+463
-468
lines changed

.github/workflows/codeql-analysis.yml

+27-28
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ name: "CodeQL"
1313

1414
on:
1515
push:
16-
branches: [ v2, master, v* ]
16+
branches: [ v* ]
1717
pull_request:
18-
# The branches below must be a subset of the branches above
19-
branches: [ v2 ]
18+
branches: [ v* ]
2019
schedule:
2120
- cron: '41 1 * * 3'
2221

@@ -37,34 +36,34 @@ jobs:
3736
# Learn more about CodeQL language support at https://git.io/codeql-language-support
3837

3938
steps:
40-
- name: Checkout repository
41-
uses: actions/checkout@v2
39+
- name: Checkout repository
40+
uses: actions/checkout@v2
4241

43-
# Initializes the CodeQL tools for scanning.
44-
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v1
46-
with:
47-
languages: ${{ matrix.language }}
48-
# If you wish to specify custom queries, you can do so here or in a config file.
49-
# By default, queries listed here will override any specified in a config file.
50-
# Prefix the list here with "+" to use these queries and those in the config file.
51-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
42+
# Initializes the CodeQL tools for scanning.
43+
- name: Initialize CodeQL
44+
uses: github/codeql-action/init@v1
45+
with:
46+
languages: ${{ matrix.language }}
47+
# If you wish to specify custom queries, you can do so here or in a config file.
48+
# By default, queries listed here will override any specified in a config file.
49+
# Prefix the list here with "+" to use these queries and those in the config file.
50+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5251

53-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54-
# If this step fails, then you should remove it and run the build manually (see below)
55-
- name: Autobuild
56-
uses: github/codeql-action/autobuild@v1
52+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
53+
# If this step fails, then you should remove it and run the build manually (see below)
54+
- name: Autobuild
55+
uses: github/codeql-action/autobuild@v1
5756

58-
# ℹ️ Command-line programs to run using the OS shell.
59-
# 📚 https://git.io/JvXDl
57+
# ℹ️ Command-line programs to run using the OS shell.
58+
# 📚 https://git.io/JvXDl
6059

61-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62-
# and modify them (or add more) to build your code if your project
63-
# uses a compiled language
60+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
61+
# and modify them (or add more) to build your code if your project
62+
# uses a compiled language
6463

65-
#- run: |
66-
# make bootstrap
67-
# make release
64+
#- run: |
65+
# make bootstrap
66+
# make release
6867

69-
- name: Perform CodeQL Analysis
70-
uses: github/codeql-action/analyze@v1
68+
- name: Perform CodeQL Analysis
69+
uses: github/codeql-action/analyze@v1

.github/workflows/go.yml

-104
This file was deleted.

.github/workflows/golang.yml

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Go
2+
3+
on:
4+
push:
5+
branches: [ v* ]
6+
pull_request:
7+
branches: [ v* ]
8+
9+
jobs:
10+
# Test
11+
tests:
12+
name: Test go${{ matrix.go }} on ${{ matrix.os }}
13+
14+
strategy:
15+
matrix:
16+
os:
17+
- 'ubuntu-latest'
18+
- 'macos-latest'
19+
- 'windows-latest'
20+
go:
21+
- '1.16'
22+
- '1.17'
23+
- '1.18'
24+
25+
runs-on: ${{ matrix.os }}
26+
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v2
30+
31+
- name: Setup Go
32+
uses: actions/setup-go@v2
33+
with:
34+
go-version: ${{ matrix.go }}
35+
36+
- name: Get dependencies
37+
run: go mod download
38+
39+
- name: Test
40+
run: go test -v -race ./...
41+
42+
# Lint
43+
# lint:
44+
# name: Lint go${{ matrix.go }}
45+
#
46+
# strategy:
47+
# matrix:
48+
# go:
49+
# - 1.16
50+
# - 1.17
51+
# - 1.18
52+
#
53+
# runs-on: ubuntu-latest
54+
#
55+
# steps:
56+
# - uses: actions/checkout@v2
57+
# - uses: actions/setup-go@v2
58+
# with:
59+
# go-version: ${{ matrix.go }}
60+
# - uses: golangci/golangci-lint-action@v2
61+
# with:
62+
# version: v1.45
63+
64+
# Build
65+
build:
66+
name: Build go${{ matrix.go }} ${{ matrix.goos }}/${{ matrix.goarch }} on ${{ matrix.os }}
67+
68+
strategy:
69+
matrix:
70+
# `go tool dist list` with many exclusions
71+
include:
72+
- { os: ubuntu-latest, goos: linux, goarch: amd64 }
73+
- { os: ubuntu-latest, goos: linux, goarch: arm64 }
74+
- { os: ubuntu-latest, goos: linux, goarch: ppc64le }
75+
76+
- { os: ubuntu-latest, goos: android, goarch: amd64 }
77+
- { os: ubuntu-latest, goos: android, goarch: arm64 }
78+
79+
- { os: ubuntu-latest, goos: freebsd, goarch: amd64 }
80+
- { os: ubuntu-latest, goos: freebsd, goarch: arm64 }
81+
82+
- { os: ubuntu-latest, goos: openbsd, goarch: amd64 }
83+
- { os: ubuntu-latest, goos: openbsd, goarch: arm64 }
84+
85+
# MacOS IOKit required, so no cross-build available
86+
# - { os: ubuntu-latest, goos: darwin, goarch: amd64 }
87+
# - { os: ubuntu-latest, goos: darwin, goarch: arm64 }
88+
89+
- { os: macos-latest, goos: darwin, goarch: amd64 }
90+
# Currently `macos-latest` is equeal to `macos-11` which does not support arm64
91+
# - { os: macos-latest, goos: darwin, goarch: arm64 }
92+
93+
- { os: windows-latest, goos: windows, goarch: amd64 }
94+
- { os: windows-latest, goos: windows, goarch: arm64 }
95+
96+
runs-on: ${{ matrix.os }}
97+
98+
env:
99+
GOOS: ${{ matrix.goos }}
100+
GOARCH: ${{ matrix.goarch }}
101+
102+
steps:
103+
- name: Checkout
104+
uses: actions/checkout@v2
105+
106+
- name: Setup Go
107+
uses: actions/setup-go@v2
108+
with:
109+
go-version: 1.18
110+
111+
- name: Get dependencies
112+
run: go mod download
113+
114+
- name: Build
115+
run: go build

.golangci.yml

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
run:
2+
timeout: 3m
3+
issues-exit-code: 1
4+
concurrency: 4
5+
allow-parallel-runners: true
6+
tests: true
7+
8+
output:
9+
format: colored-line-number
10+
print-issued-lines: true
11+
print-linter-name: true
12+
13+
linters-settings:
14+
cyclop:
15+
max-complexity: 20
16+
package-average: 0.0 # the maximal average package complexity. If it's higher than 0.0 (float) the check is enabled (default 0.0)
17+
skip-tests: true
18+
funlen:
19+
lines: 60
20+
statements: 40
21+
golint:
22+
min-confidence: 0.9
23+
24+
gci:
25+
no-inline-comments: true
26+
no-prefix-comments: true
27+
sections:
28+
- standard
29+
- default
30+
- prefix(github.com/albenik/go-serial)
31+
section-separators:
32+
- newLine
33+
34+
lll:
35+
line-length: 140
36+
37+
linters:
38+
enable-all: true
39+
# Please keep in order
40+
disable:
41+
- exhaustivestruct # Unecessary annoying!
42+
- goerr113 # Useful but not in this package!
43+
- gochecknoglobals # Too paranoic!
44+
- goimports # Latest gci with sections is good enougth
45+
- 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.
46+
- interfacer # The linter 'interfacer' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner.
47+
- ireturn # Yes! Some functions retures interfaces.
48+
- 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'.
49+
- nlreturn # Personally I hate mandatory blank lines before returns.
50+
- paralleltest
51+
- 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.
52+
- varnamelen # Annoying!
53+
- unparam # Panics with GOOS=linux
54+
- wrapcheck # Not needed!
55+
- wsl # Unecessary annoying!
56+
57+
issues:
58+
exclude-rules:
59+
- path: _test\.go
60+
linters:
61+
- gochecknoglobals
62+
- funlen
63+
- lll
64+
- wrapcheck
65+
66+
- text: "Line contains TODO/BUG/FIXME"
67+
linters:
68+
- godox
69+
70+
- source: "//go:generate"
71+
linters:
72+
- lll
73+
74+
- source: "C\\."
75+
linters:
76+
- unconvert
77+
78+
- source: "(?:dataBits:\\s+\\d+|baudRate:\\s+\\d+)"
79+
linters:
80+
- gomnd

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2018, Veniamin Albaev
3+
Copyright (c) 2019-2022, Veniamin Albaev.
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

0 commit comments

Comments
 (0)