Skip to content

Commit

Permalink
chore: add Makefile and precommit checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobgy committed Feb 5, 2022
1 parent 3244bc6 commit a400ec4
Show file tree
Hide file tree
Showing 6 changed files with 362 additions and 4 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
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2022 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# All of these should pass before sending a PR.
precommit: test lint tidy

test: FORCE
go test ./...

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

tidy: FORCE
go mod tidy

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 a400ec4

Please sign in to comment.