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
This commit is contained in:
6
.github/workflows/go.yml
vendored
6
.github/workflows/go.yml
vendored
@@ -25,6 +25,12 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
go get -v -t -d ./...
|
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
|
- name: Test
|
||||||
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
|
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,10 @@ package internal
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
context "context"
|
||||||
|
reflect "reflect"
|
||||||
|
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
connectivity "google.golang.org/grpc/connectivity"
|
connectivity "google.golang.org/grpc/connectivity"
|
||||||
reflect "reflect"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// MocketcdConn is a mock of etcdConn interface
|
// MocketcdConn is a mock of etcdConn interface
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
package internal
|
package internal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
gomock "github.com/golang/mock/gomock"
|
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
|
|
||||||
|
gomock "github.com/golang/mock/gomock"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MockUpdateListener is a mock of UpdateListener interface
|
// MockUpdateListener is a mock of UpdateListener interface
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
//go:build linux || darwin
|
||||||
// +build linux darwin
|
// +build linux darwin
|
||||||
|
|
||||||
package fs
|
package fs
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
//go:build linux || darwin
|
||||||
// +build linux darwin
|
// +build linux darwin
|
||||||
|
|
||||||
package proc
|
package proc
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
//go:build debug
|
||||||
// +build debug
|
// +build debug
|
||||||
|
|
||||||
package search
|
package search
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
//go:build linux
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
package stat
|
package stat
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
//go:build linux
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
package stat
|
package stat
|
||||||
|
|||||||
@@ -5,9 +5,10 @@
|
|||||||
package internal
|
package internal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
reflect "reflect"
|
||||||
|
|
||||||
mgo "github.com/globalsign/mgo"
|
mgo "github.com/globalsign/mgo"
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
reflect "reflect"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// MockMgoCollection is a mock of MgoCollection interface
|
// MockMgoCollection is a mock of MgoCollection interface
|
||||||
|
|||||||
@@ -5,9 +5,10 @@
|
|||||||
package mongo
|
package mongo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
reflect "reflect"
|
||||||
|
|
||||||
bson "github.com/globalsign/mgo/bson"
|
bson "github.com/globalsign/mgo/bson"
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
reflect "reflect"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// MockIter is a mock of Iter interface
|
// MockIter is a mock of Iter interface
|
||||||
|
|||||||
@@ -17,10 +17,11 @@ func TestPoolGet(t *testing.T) {
|
|||||||
ch := make(chan lang.PlaceholderType)
|
ch := make(chan lang.PlaceholderType)
|
||||||
|
|
||||||
for i := 0; i < limit; i++ {
|
for i := 0; i < limit; i++ {
|
||||||
|
var fail AtomicBool
|
||||||
go func() {
|
go func() {
|
||||||
v := stack.Get()
|
v := stack.Get()
|
||||||
if v.(int) != 1 {
|
if v.(int) != 1 {
|
||||||
t.Fatal("unmatch value")
|
fail.Set(true)
|
||||||
}
|
}
|
||||||
ch <- lang.Placeholder
|
ch <- lang.Placeholder
|
||||||
}()
|
}()
|
||||||
@@ -30,6 +31,10 @@ func TestPoolGet(t *testing.T) {
|
|||||||
case <-time.After(time.Second):
|
case <-time.After(time.Second):
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if fail.True() {
|
||||||
|
t.Fatal("unmatch value")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,14 @@ package mock
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
context "context"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
|
||||||
grpc "google.golang.org/grpc"
|
grpc "google.golang.org/grpc"
|
||||||
codes "google.golang.org/grpc/codes"
|
codes "google.golang.org/grpc/codes"
|
||||||
status "google.golang.org/grpc/status"
|
status "google.golang.org/grpc/status"
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
|
||||||
sync "sync"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -147,11 +148,14 @@ func file_deposit_proto_rawDescGZIP() []byte {
|
|||||||
return file_deposit_proto_rawDescData
|
return file_deposit_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_deposit_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
var (
|
||||||
var file_deposit_proto_goTypes = []interface{}{
|
file_deposit_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||||
(*DepositRequest)(nil), // 0: mock.DepositRequest
|
file_deposit_proto_goTypes = []interface{}{
|
||||||
(*DepositResponse)(nil), // 1: mock.DepositResponse
|
(*DepositRequest)(nil), // 0: mock.DepositRequest
|
||||||
}
|
(*DepositResponse)(nil), // 1: mock.DepositResponse
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
var file_deposit_proto_depIdxs = []int32{
|
var file_deposit_proto_depIdxs = []int32{
|
||||||
0, // 0: mock.DepositService.Deposit:input_type -> mock.DepositRequest
|
0, // 0: mock.DepositService.Deposit:input_type -> mock.DepositRequest
|
||||||
1, // 1: mock.DepositService.Deposit:output_type -> mock.DepositResponse
|
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.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
var _ context.Context
|
var (
|
||||||
var _ grpc.ClientConnInterface
|
_ context.Context
|
||||||
|
_ grpc.ClientConnInterface
|
||||||
|
)
|
||||||
|
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
// is compatible with the grpc package it is being compiled against.
|
// 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.
|
// UnimplementedDepositServiceServer can be embedded to have forward compatible implementations.
|
||||||
type UnimplementedDepositServiceServer struct {
|
type UnimplementedDepositServiceServer struct{}
|
||||||
}
|
|
||||||
|
|
||||||
func (*UnimplementedDepositServiceServer) Deposit(context.Context, *DepositRequest) (*DepositResponse, error) {
|
func (*UnimplementedDepositServiceServer) Deposit(context.Context, *DepositRequest) (*DepositResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented")
|
||||||
|
|||||||
Reference in New Issue
Block a user