chore(lint): remove error lint

This commit is contained in:
qloog
2023-04-10 17:56:32 +08:00
parent 70a98e2e96
commit 1e368b93ed
6 changed files with 13 additions and 4 deletions

View File

@@ -230,7 +230,7 @@ linters:
- dogsled
# - dupl
- errcheck
- gochecknoinits
# - gochecknoinits
- goconst
- gocyclo
- gofmt

View File

@@ -7,6 +7,7 @@ import (
"google.golang.org/protobuf/types/known/structpb"
)
// GrpcStatus grpc error
type GrpcStatus struct {
status *status.Status
details []proto.Message
@@ -18,6 +19,7 @@ func New(code codes.Code, msg string) *GrpcStatus {
}
}
// Status .
func (g *GrpcStatus) Status(details ...proto.Message) *status.Status {
details = append(details, g.details...)
st, err := g.status.WithDetails(details...)
@@ -27,11 +29,13 @@ func (g *GrpcStatus) Status(details ...proto.Message) *status.Status {
return st
}
// WithDetails .
func (g *GrpcStatus) WithDetails(details ...proto.Message) *GrpcStatus {
g.details = details
return g
}
// NewDetails .
func NewDetails(details map[string]interface{}) proto.Message {
detailStruct, err := structpb.NewStruct(details)
if err != nil {

View File

@@ -14,7 +14,9 @@ import (
)
const (
TraceName = "github.com/go-eagle/eagle/trace/plugins/function"
// TraceName function trance name
TraceName = "github.com/go-eagle/eagle/trace/plugins/function"
// PluginName plugin category name
PluginName = "function"
)
@@ -24,6 +26,7 @@ func init() {
tracer = otel.GetTracerProvider().Tracer(TraceName, trace.WithInstrumentationVersion(contrib.SemVersion()))
}
// StartFromContext create a new context
func StartFromContext(ctx context.Context) (context.Context, trace.Span) {
var spanAttrs []trace.SpanStartOption

View File

@@ -27,7 +27,7 @@ type Server struct {
readTimeout time.Duration
writeTimeout time.Duration
endpoint *url.URL
log log.Logger
// log log.Logger
}
// defaultServer return a default config server

View File

@@ -21,5 +21,4 @@ func TestPrintStackTrace(t *testing.T) {
panic("throw a panic")
})
}

View File

@@ -7,8 +7,11 @@ import (
)
const (
// DateTime date time layout
DateTime = "2006-01-02 15:04:05"
// DateOnly date layout
DateOnly = "2006-01-02"
// TimeOnly time layout
TimeOnly = "15:04:05"
)