diff --git a/.golangci.yml b/.golangci.yml index e6f8be83b..307f22b7c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -21,6 +21,9 @@ linters: - revive - errorlint + # License header check: + - goheader + linters-settings: govet: # These govet checks are disabled by default, but they're useful. @@ -30,6 +33,34 @@ linters-settings: - sortslice - unusedwrite + goheader: + values: + const: + COMPANY: 'Uber Technologies, Inc.' + regexp: + YEAR_RANGE: '\d{4}(-\d{4})?' + template: |- + Copyright (c) {{ YEAR_RANGE }} {{ COMPANY }} + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + issues: # Print all issues reported by all linters. max-issues-per-linter: 0 @@ -62,9 +93,3 @@ issues: - linters: [revive] path: '_test\.go$' text: 'should not use dot imports' - - # Ignore logger.Sync() errcheck failures in example_test.go - # since those are intended to be uncomplicated examples. - - linters: [errcheck] - path: example_test.go - text: 'Error return value of `logger.Sync` is not checked' diff --git a/Makefile b/Makefile index aef997620..bbda9cc12 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ build: go build ./... .PHONY: lint -lint: golangci-lint tidy-lint license-lint fx-lint docs-lint +lint: golangci-lint tidy-lint fx-lint docs-lint .PHONY: test test: @@ -58,10 +58,6 @@ tidy-lint: go mod tidy && \ git diff --exit-code -- go.mod go.sum) &&) true -.PHONY: license-lint -license-lint: - ./checklicense.sh - .PHONY: fx-lint fx-lint: $(FXLINT) @$(FXLINT) ./... @@ -76,4 +72,3 @@ $(MDOX): tools/go.mod $(FXLINT): tools/cmd/fxlint/main.go cd tools && go install go.uber.org/fx/tools/cmd/fxlint - diff --git a/checklicense.sh b/checklicense.sh deleted file mode 100755 index 28057d2fb..000000000 --- a/checklicense.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -e - -ERROR_COUNT=0 -while read -r file -do - case "$(head -1 "${file}")" in - *"Copyright (c) "*" Uber Technologies, Inc.") - # everything's cool - ;; - *) - echo "$file is missing license header." - (( ERROR_COUNT++ )) - ;; - esac -done < <(git ls-files "*\.go" | grep -v /testdata/) - -exit $ERROR_COUNT diff --git a/signal.go b/signal.go index 1dbfd840e..8a86599ca 100644 --- a/signal.go +++ b/signal.go @@ -12,7 +12,7 @@ // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPSignalE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN diff --git a/signal_test.go b/signal_test.go index 527213244..8e8030ae7 100644 --- a/signal_test.go +++ b/signal_test.go @@ -12,7 +12,7 @@ // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPSignalE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN