ci: add Lint check on commits (#1086)

* ci: add Lint check on commits

* ci: fix Lint script error

* test: fix go vet errors

* test: fix go vet errors, remove gofumpt to check go vet

* test: fix go vet errors, try gofumpt

* test: fix go vet errors, try gofumpt, round 1

* test: fix go vet errors, try gofumpt, round 2

* ci: fix Lint errors
master
Kevin Wan 3 years ago committed by GitHub
parent d87d203c3b
commit 8403ed16ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -25,6 +25,12 @@ jobs:
run: |
go get -v -t -d ./...
- name: Lint
run: |
go vet -stdmethods=false $(go list ./...)
go install mvdan.cc/gofumpt@latest
test -z "$(gofumpt -s -l -extra .)"
- name: Test
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...

@ -6,9 +6,10 @@ package internal
import (
context "context"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
connectivity "google.golang.org/grpc/connectivity"
reflect "reflect"
)
// MocketcdConn is a mock of etcdConn interface

@ -5,8 +5,9 @@
package internal
import (
gomock "github.com/golang/mock/gomock"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
)
// MockUpdateListener is a mock of UpdateListener interface

@ -1,3 +1,4 @@
//go:build linux || darwin
// +build linux darwin
package fs

@ -1,3 +1,4 @@
//go:build linux || darwin
// +build linux darwin
package proc

@ -1,3 +1,4 @@
//go:build debug
// +build debug
package search

@ -1,3 +1,4 @@
//go:build linux
// +build linux
package stat

@ -1,3 +1,4 @@
//go:build linux
// +build linux
package stat

@ -5,9 +5,10 @@
package internal
import (
reflect "reflect"
mgo "github.com/globalsign/mgo"
gomock "github.com/golang/mock/gomock"
reflect "reflect"
)
// MockMgoCollection is a mock of MgoCollection interface

@ -5,9 +5,10 @@
package mongo
import (
reflect "reflect"
bson "github.com/globalsign/mgo/bson"
gomock "github.com/golang/mock/gomock"
reflect "reflect"
)
// MockIter is a mock of Iter interface

@ -17,10 +17,11 @@ func TestPoolGet(t *testing.T) {
ch := make(chan lang.PlaceholderType)
for i := 0; i < limit; i++ {
var fail AtomicBool
go func() {
v := stack.Get()
if v.(int) != 1 {
t.Fatal("unmatch value")
fail.Set(true)
}
ch <- lang.Placeholder
}()
@ -30,6 +31,10 @@ func TestPoolGet(t *testing.T) {
case <-time.After(time.Second):
t.Fail()
}
if fail.True() {
t.Fatal("unmatch value")
}
}
}

@ -8,13 +8,14 @@ package mock
import (
context "context"
reflect "reflect"
sync "sync"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
@ -147,11 +148,14 @@ func file_deposit_proto_rawDescGZIP() []byte {
return file_deposit_proto_rawDescData
}
var file_deposit_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_deposit_proto_goTypes = []interface{}{
var (
file_deposit_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
file_deposit_proto_goTypes = []interface{}{
(*DepositRequest)(nil), // 0: mock.DepositRequest
(*DepositResponse)(nil), // 1: mock.DepositResponse
}
)
var file_deposit_proto_depIdxs = []int32{
0, // 0: mock.DepositService.Deposit:input_type -> mock.DepositRequest
1, // 1: mock.DepositService.Deposit:output_type -> mock.DepositResponse
@ -214,8 +218,10 @@ func file_deposit_proto_init() {
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface
var (
_ context.Context
_ grpc.ClientConnInterface
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
@ -251,8 +257,7 @@ type DepositServiceServer interface {
}
// UnimplementedDepositServiceServer can be embedded to have forward compatible implementations.
type UnimplementedDepositServiceServer struct {
}
type UnimplementedDepositServiceServer struct{}
func (*UnimplementedDepositServiceServer) Deposit(context.Context, *DepositRequest) (*DepositResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented")

Loading…
Cancel
Save