Skip to content

Commit

Permalink
chore: setup golangci-lint for precommit check & add go mod tidy chec…
Browse files Browse the repository at this point in the history
…k to github actions
  • Loading branch information
Bobgy committed Jan 22, 2022
1 parent 7087019 commit fa224a9
Show file tree
Hide file tree
Showing 6 changed files with 339 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ jobs:
run: go build -v ./...
- name: Test
run: go test -v ./...
- name: Mod Tidy
run: go mod tidy && git diff --exit-code -- go.mod go.sum || (echo "go modules are not tidy, run 'go mod tidy'." && exit 1)
2 changes: 2 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ jobs:
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.
# NOTICE: golangci-lint version should be the same as go.mod. When upgrading, also update go.mod by:
# go get github.com/golangci/[email protected]
version: v1.29
14 changes: 6 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

precommit: FORCE tidy lint csv

csv: FORCE
go run . csv github.com/google/go-licenses

lint: FORCE
# There's no need to lint third_party packages, so we explicitly list other packages here.
golint --set_exit_status . licenses/...
precommit: tidy lint

tidy: FORCE
go mod tidy

lint: FORCE
# Note, golangci-lint version is pinned in go.mod. When upgrading, also
# upgrade version in .github/workflows/golangci-lint.yml.
go run github.com/golangci/golangci-lint/cmd/golangci-lint run -v

FORCE: ;
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.16

require (
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golangci/golangci-lint v1.29.0
github.com/google/go-cmp v0.5.6
github.com/google/go-replayers/httpreplay v1.0.0
github.com/google/licenseclassifier v0.0.0-20210722185704-3043a050f148
Expand Down
Loading

0 comments on commit fa224a9

Please sign in to comment.