Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add Makefile and a precommit check #101

Merged
merged 1 commit into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Bobgy marked this conversation as resolved.
Show resolved Hide resolved
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