Add .golangci.yml

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
Simon Pasquier 2019-04-25 10:38:07 +02:00
parent 53800fb9d3
commit 6894bb3c7c
6 changed files with 16 additions and 1 deletions

5
.golangci.yml Normal file
View File

@ -0,0 +1,5 @@
# Run only staticcheck for now. Additional linters will be enabled one-by-one.
linters:
enable:
- staticcheck
disable-all: true

View File

@ -10,6 +10,6 @@ go:
script: script:
- make check_license unused test-short - make check_license unused test-short
- if [[ ! $TRAVIS_GO_VERSION =~ ^1\.(7|8|9)\.[x0-9]+$ ]]; then make staticcheck; fi - if [[ ! $TRAVIS_GO_VERSION =~ ^1\.(7|8|9)\.[x0-9]+$ ]]; then make lint; fi
# style is only checked against the latest supported Go version. # style is only checked against the latest supported Go version.
- if [[ $TRAVIS_GO_VERSION =~ ^1\.(12)\. ]]; then make style; fi - if [[ $TRAVIS_GO_VERSION =~ ^1\.(12)\. ]]; then make style; fi

View File

@ -330,6 +330,8 @@ type fancyResponseWriterDelegator struct {
} }
func (f *fancyResponseWriterDelegator) CloseNotify() <-chan bool { func (f *fancyResponseWriterDelegator) CloseNotify() <-chan bool {
//lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to
//remove support from client_golang yet.
return f.ResponseWriter.(http.CloseNotifier).CloseNotify() return f.ResponseWriter.(http.CloseNotifier).CloseNotify()
} }

View File

@ -76,6 +76,8 @@ type hijackerDelegator struct{ *responseWriterDelegator }
type readerFromDelegator struct{ *responseWriterDelegator } type readerFromDelegator struct{ *responseWriterDelegator }
func (d closeNotifierDelegator) CloseNotify() <-chan bool { func (d closeNotifierDelegator) CloseNotify() <-chan bool {
//lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to
//remove support from client_golang yet.
return d.ResponseWriter.(http.CloseNotifier).CloseNotify() return d.ResponseWriter.(http.CloseNotifier).CloseNotify()
} }
func (d flusherDelegator) Flush() { func (d flusherDelegator) Flush() {

View File

@ -161,6 +161,8 @@ func newDelegator(w http.ResponseWriter, observeWriteHeaderFunc func(int)) deleg
} }
id := 0 id := 0
//lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to
//remove support from client_golang yet.
if _, ok := w.(http.CloseNotifier); ok { if _, ok := w.(http.CloseNotifier); ok {
id += closeNotifier id += closeNotifier
} }

View File

@ -294,6 +294,8 @@ func (t *testFlusher) Flush() { t.flushCalled = true }
func TestInterfaceUpgrade(t *testing.T) { func TestInterfaceUpgrade(t *testing.T) {
w := &testResponseWriter{} w := &testResponseWriter{}
d := newDelegator(w, nil) d := newDelegator(w, nil)
//lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to
//remove support from client_golang yet.
d.(http.CloseNotifier).CloseNotify() d.(http.CloseNotifier).CloseNotify()
if !w.closeNotifyCalled { if !w.closeNotifyCalled {
t.Error("CloseNotify not called") t.Error("CloseNotify not called")
@ -312,6 +314,8 @@ func TestInterfaceUpgrade(t *testing.T) {
f := &testFlusher{} f := &testFlusher{}
d = newDelegator(f, nil) d = newDelegator(f, nil)
//lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to
//remove support from client_golang yet.
if _, ok := d.(http.CloseNotifier); ok { if _, ok := d.(http.CloseNotifier); ok {
t.Error("delegator unexpectedly implements http.CloseNotifier") t.Error("delegator unexpectedly implements http.CloseNotifier")
} }