forked from ServiceWeaver/weaver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switched to using staticcheck linter.
Previously, we used golangci-lint, but the Go team recommended we use staticcheck instead.
- Loading branch information
1 parent
cc52b9b
commit e23ea68
Showing
27 changed files
with
67 additions
and
85 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 |
---|---|---|
|
@@ -41,12 +41,12 @@ jobs: | |
- name: Cache linter | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/go/bin/golangci-lint | ||
key: golangci-lint-v1.51.2 | ||
path: ~/go/bin/staticcheck | ||
key: staticcheck-v0.4.3 | ||
if: ${{ matrix.command == 'lint' }} | ||
|
||
- name: Install linter | ||
run: go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
run: go install honnef.co/go/tools/cmd/[email protected] | ||
if: ${{ matrix.command == 'lint' }} | ||
|
||
- name: Build the weaver binary | ||
|
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
# generate -- Generates code | ||
# build -- Builds the module | ||
# vet -- Runs go vet | ||
# lint -- Runs golangci-lint | ||
# lint -- Runs staticcheck | ||
# test -- Tests the module | ||
# testrace -- Tests the module for data races | ||
# | ||
|
@@ -53,16 +53,16 @@ function cmd_vet() { | |
} | ||
|
||
function cmd_lint() { | ||
if ! exists golangci-lint; then | ||
printf "golangci-lint not found; install via\ngo install github.com/golangci/golangci-lint/cmd/[email protected]\n" >&2 | ||
if ! exists staticcheck; then | ||
printf "staticcheck not found; install via\ngo install honnef.co/go/tools/cmd/[email protected]\n" >&2 | ||
exit 1 | ||
fi | ||
|
||
golangci-lint --timeout=10m run ./... | ||
staticcheck ./... | ||
|
||
# Run unused check while skipping uses found in tests. This helps us | ||
# identify non-test code that is only used from tests. | ||
golangci-lint --timeout=10m run --enable unused --tests=false ./... | ||
staticcheck -tests=false ./... | ||
} | ||
|
||
function cmd_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
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
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
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,17 @@ | ||
# In addition to the checks disabled by default [1], we also disable the | ||
# following style checks: | ||
# | ||
# - ST1005 [2]. This check enforces that error messages do not begin with a | ||
# capital letter or end with punctuation. However, we have many error | ||
# messages that begin with exported names or proper nouns (e.g., | ||
# NewEnvelopeConn, Service Weaver). | ||
# - ST1012 [3]. This check enforces that exported errors are prefixed with Err | ||
# (e.g., ErrFoo). weaver.RemoteCallError violates this. | ||
# | ||
# [1]: https://staticcheck.dev/docs/configuration/options/#checks. | ||
# [2]: https://staticcheck.dev/docs/checks/#ST1005 | ||
# [3]: https://staticcheck.dev/docs/checks/#ST1012 | ||
# | ||
# TODO(mwhittaker): Think about enabling some of these checks and updating our | ||
# code accordingly. | ||
checks = ["all", "-ST1000", "-ST1003", "-ST1005", "-ST1012", "-ST1016", "-ST1020", "-ST1021", "-ST1022"] |
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.