-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update codes and re-enable in golangci-lint (#64)
* fix test hung Signed-off-by: Loong Dai <[email protected]> * add GH for PR Signed-off-by: Loong Dai <[email protected]> * support analyzer Signed-off-by: Loong Dai <[email protected]>
- Loading branch information
Showing
21 changed files
with
250 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: gci | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
name: Build ${{ matrix.target_os }}_${{ matrix.target_arch }} binaries | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
GOVER: 1.18 | ||
GOOS: ${{ matrix.target_os }} | ||
GOARCH: ${{ matrix.target_arch }} | ||
GOPROXY: https://proxy.golang.org | ||
ARCHIVE_OUTDIR: dist/archives | ||
TEST_OUTPUT_FILE_PREFIX: test_report | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-2019, macOS-latest] | ||
target_arch: [arm, arm64, amd64] | ||
include: | ||
- os: ubuntu-latest | ||
target_os: linux | ||
- os: windows-2019 | ||
target_os: windows | ||
- os: macOS-latest | ||
target_os: darwin | ||
exclude: | ||
- os: windows-2019 | ||
target_arch: arm | ||
- os: windows-2019 | ||
target_arch: arm64 | ||
- os: macOS-latest | ||
target_arch: arm | ||
steps: | ||
- name: Set up Go ${{ env.GOVER }} | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GOVER }} | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
- name: Cache Go modules (Linux) | ||
if: matrix.target_os == 'linux' | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-build-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-build- | ||
- name: Cache Go modules (Windows) | ||
if: matrix.target_os == 'windows' | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~\AppData\Local\go-build | ||
~\go\pkg\mod | ||
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-build-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-build- | ||
- name: Cache Go modules (macOS) | ||
if: matrix.target_os == 'darwin' | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/Library/Caches/go-build | ||
~/go/pkg/mod | ||
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-build-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-build- | ||
- name: golangci-lint | ||
if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux' | ||
uses: golangci/[email protected] | ||
with: | ||
version: ${{ env.GOLANGCILINT_VER }} | ||
- name: Run make test | ||
env: | ||
COVERAGE_OPTS: "-coverprofile=coverage.txt -covermode=atomic" | ||
if: matrix.target_arch == 'amd64' | ||
run: make test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# options for analysis running | ||
run: | ||
# default concurrency is a available CPU number | ||
concurrency: 4 | ||
|
||
# timeout for analysis, e.g. 30s, 5m, default is 1m | ||
deadline: 10m | ||
|
||
# exit code when at least one issue was found, default is 1 | ||
issues-exit-code: 1 | ||
|
||
# include test files or not, default is true | ||
tests: true | ||
|
||
# list of build tags, all linters use it. Default is empty list. | ||
build-tags: | ||
|
||
# which dirs to skip: they won't be analyzed; | ||
# can use regexp here: generated.*, regexp is applied on full path; | ||
# default value is empty list, but next dirs are always skipped independently | ||
# from this option's value: | ||
# third_party$, testdata$, examples$, Godeps$, builtin$ | ||
skip-dirs: | ||
|
||
# which files to skip: they will be analyzed, but issues from them | ||
# won't be reported. Default value is empty list, but there is | ||
# no need to include all autogenerated files, we confidently recognize | ||
# autogenerated files. If it's not please let us know. | ||
skip-files: | ||
|
||
# output configuration options | ||
output: | ||
# colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number" | ||
format: tab | ||
|
||
# print lines of code with issue, default is true | ||
print-issued-lines: true | ||
|
||
# print linter name in the end of issue text, default is true | ||
print-linter-name: true | ||
|
||
|
||
# all available settings of specific linters | ||
linters-settings: | ||
gci: | ||
# Checks that no inline Comments are present. | ||
# Default: false | ||
no-inline-comments: false | ||
|
||
# Checks that no prefix Comments(comment lines above an import) are present. | ||
# Default: false | ||
no-prefix-comments: false | ||
|
||
# Section configuration to compare against. | ||
# Section names are case-insensitive and may contain parameters in (). | ||
# Default: ["standard", "default"] | ||
sections: | ||
- standard # Captures all standard packages if they do not match another section. | ||
- default # Contains all imports that could not be matched to another section type. | ||
- prefix(github.com/daixiang0/gci) # Groups all imports with the specified Prefix. | ||
|
||
# Separators that should be present between sections. | ||
# Default: ["newLine"] | ||
section-separators: | ||
- newLine | ||
|
||
gofmt: | ||
# simplify code: gofmt with `-s` option, true by default | ||
simplify: true | ||
goimports: | ||
# put imports beginning with prefix after 3rd-party packages; | ||
# it's a comma-separated list of prefixes | ||
local-prefixes: github.com/daixiang0/gci | ||
|
||
linters: | ||
fast: false | ||
enable: | ||
- gofmt | ||
- gofumpt | ||
- goimports | ||
- gci | ||
disable-all: true | ||
|
||
issues: | ||
exclude: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.