Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: enable gocritic.exitAfterDefer #8409

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ linters-settings:
disabled-checks:
- regexpMust
- appendAssign
- exitAfterDefer
- ifElseChain
gosec:
# To specify a set of rules to explicitly exclude.
Expand Down
4 changes: 2 additions & 2 deletions client/pd_service_discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ func newTestServer(isLeader bool) *testServer {
func (s *testServer) run() {
lis, err := net.Listen("tcp", s.addr)
if err != nil {
log.Fatalf("failed to serve: %v", err)
log.Panicf("failed to serve: %v", err)
Copy link
Member

@HuSharp HuSharp Jul 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe can log.Panic("...", zap.error(err)) ?

}
if err := s.grpcServer.Serve(lis); err != nil {
log.Fatalf("failed to serve: %v", err)
log.Panicf("failed to serve: %v", err)
}
}

Expand Down
6 changes: 3 additions & 3 deletions client/testutil/tempurl.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@
}
time.Sleep(time.Second)
}
log.Fatal("failed to alloc test URL")
log.Panic("failed to alloc test URL")

Check warning on line 40 in client/testutil/tempurl.go

View check run for this annotation

Codecov / codecov/patch

client/testutil/tempurl.go#L40

Added line #L40 was not covered by tests
return ""
}

func tryAllocTestURL() string {
l, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
log.Fatal("listen failed", zap.Error(err))
log.Panic("listen failed", zap.Error(err))

Check warning on line 47 in client/testutil/tempurl.go

View check run for this annotation

Codecov / codecov/patch

client/testutil/tempurl.go#L47

Added line #L47 was not covered by tests
}
addr := fmt.Sprintf("http://%s", l.Addr())
err = l.Close()
if err != nil {
log.Fatal("close failed", zap.Error(err))
log.Panic("close failed", zap.Error(err))

Check warning on line 52 in client/testutil/tempurl.go

View check run for this annotation

Codecov / codecov/patch

client/testutil/tempurl.go#L52

Added line #L52 was not covered by tests
}

testAddrMutex.Lock()
Expand Down
2 changes: 1 addition & 1 deletion client/tso_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
func (c *tsoClient) GetTSOAllocatorClientConnByDCLocation(dcLocation string) (*grpc.ClientConn, string) {
url, ok := c.tsoAllocators.Load(dcLocation)
if !ok {
log.Fatal("[tso] the allocator leader should exist", zap.String("dc-location", dcLocation))
log.Panic("[tso] the allocator leader should exist", zap.String("dc-location", dcLocation))

Check warning on line 235 in client/tso_client.go

View check run for this annotation

Codecov / codecov/patch

client/tso_client.go#L235

Added line #L235 was not covered by tests
}
cc, ok := c.svcDiscovery.GetClientConns().Load(url)
if !ok {
Expand Down
8 changes: 4 additions & 4 deletions cmd/pd-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func start(cmd *cobra.Command, args []string, services ...string) {
if err == nil {
log.ReplaceGlobals(cfg.Logger, cfg.LogProps)
} else {
log.Fatal("initialize logger error", errs.ZapError(err))
log.Panic("initialize logger error", errs.ZapError(err))
}
// Flushing any buffered log entries
defer log.Sync()
Expand All @@ -254,7 +254,7 @@ func start(cmd *cobra.Command, args []string, services ...string) {

err = join.PrepareJoinCluster(cfg)
if err != nil {
log.Fatal("join meet error", errs.ZapError(err))
log.Panic("join meet error", errs.ZapError(err))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some questions:

  1. The behavior is different from the previous
  2. Will it be printed out if we set the log level to fatal?
  3. What if the panic has a recover hook?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Yes
  2. Yes, the log will be printed when log level is fatal
  3. If exist a recover hook, the panic will be caught.

from: https://www.quasilyte.dev/blog/post/log-fatal-vs-log-panic/
The log.Panic vs log.Fatal is essentially panic vs os.Exit(1). The latter will not let deferred calls to run.

}

// Creates server.
Expand All @@ -266,7 +266,7 @@ func start(cmd *cobra.Command, args []string, services ...string) {
serviceBuilders = append(serviceBuilders, dashboard.GetServiceBuilders()...)
svr, err := server.CreateServer(ctx, cfg, services, serviceBuilders...)
if err != nil {
log.Fatal("create server failed", errs.ZapError(err))
log.Panic("create server failed", errs.ZapError(err))
}

sc := make(chan os.Signal, 1)
Expand All @@ -283,7 +283,7 @@ func start(cmd *cobra.Command, args []string, services ...string) {
}()

if err := svr.Run(); err != nil {
log.Fatal("run server failed", errs.ZapError(err))
log.Panic("run server failed", errs.ZapError(err))
}

<-ctx.Done()
Expand Down
4 changes: 2 additions & 2 deletions pkg/dashboard/distroutil/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
func MustGetResPath() string {
exePath, err := os.Executable()
if err != nil {
log.Fatal("failed to read the execution path", zap.Error(err))
log.Panic("failed to read the execution path", zap.Error(err))

Check warning on line 36 in pkg/dashboard/distroutil/distro.go

View check run for this annotation

Codecov / codecov/patch

pkg/dashboard/distroutil/distro.go#L36

Added line #L36 was not covered by tests
return ""
}
return path.Join(path.Dir(exePath), resFolderName)
Expand All @@ -46,7 +46,7 @@
resPath := MustGetResPath()
strings, err := distro.ReadResourceStringsFromFile(path.Join(resPath, stringsFileName))
if err != nil {
log.Fatal("failed to load distro strings", zap.Error(err))
log.Panic("failed to load distro strings", zap.Error(err))

Check warning on line 49 in pkg/dashboard/distroutil/distro.go

View check run for this annotation

Codecov / codecov/patch

pkg/dashboard/distroutil/distro.go#L49

Added line #L49 was not covered by tests
}
log.Info("using distribution strings", zap.Any("strings", strings))
distro.ReplaceGlobal(strings)
Expand Down
4 changes: 2 additions & 2 deletions pkg/mcs/resourcemanager/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@
if err == nil {
log.ReplaceGlobals(cfg.Logger, cfg.LogProps)
} else {
log.Fatal("initialize logger error", errs.ZapError(err))
log.Panic("initialize logger error", errs.ZapError(err))

Check warning on line 397 in pkg/mcs/resourcemanager/server/server.go

View check run for this annotation

Codecov / codecov/patch

pkg/mcs/resourcemanager/server/server.go#L397

Added line #L397 was not covered by tests
}
// Flushing any buffered log entries
log.Sync()
Expand All @@ -421,7 +421,7 @@
}()

if err := svr.Run(); err != nil {
log.Fatal("run server failed", errs.ZapError(err))
log.Panic("run server failed", errs.ZapError(err))

Check warning on line 424 in pkg/mcs/resourcemanager/server/server.go

View check run for this annotation

Codecov / codecov/patch

pkg/mcs/resourcemanager/server/server.go#L424

Added line #L424 was not covered by tests
}

<-ctx.Done()
Expand Down
2 changes: 1 addition & 1 deletion pkg/mcs/scheduling/server/grpc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
func NewService[T ConfigProvider](svr bs.Server) registry.RegistrableService {
server, ok := svr.(*Server)
if !ok {
log.Fatal("create scheduling server failed")
log.Panic("create scheduling server failed")

Check warning on line 72 in pkg/mcs/scheduling/server/grpc_service.go

View check run for this annotation

Codecov / codecov/patch

pkg/mcs/scheduling/server/grpc_service.go#L72

Added line #L72 was not covered by tests
}
return &Service{
Server: server,
Expand Down
4 changes: 2 additions & 2 deletions pkg/mcs/scheduling/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@
if err == nil {
log.ReplaceGlobals(cfg.Logger, cfg.LogProps)
} else {
log.Fatal("initialize logger error", errs.ZapError(err))
log.Panic("initialize logger error", errs.ZapError(err))

Check warning on line 596 in pkg/mcs/scheduling/server/server.go

View check run for this annotation

Codecov / codecov/patch

pkg/mcs/scheduling/server/server.go#L596

Added line #L596 was not covered by tests
}
// Flushing any buffered log entries
log.Sync()
Expand Down Expand Up @@ -621,7 +621,7 @@
}()

if err := svr.Run(); err != nil {
log.Fatal("run server failed", errs.ZapError(err))
log.Panic("run server failed", errs.ZapError(err))

Check warning on line 624 in pkg/mcs/scheduling/server/server.go

View check run for this annotation

Codecov / codecov/patch

pkg/mcs/scheduling/server/server.go#L624

Added line #L624 was not covered by tests
}

<-ctx.Done()
Expand Down
2 changes: 1 addition & 1 deletion pkg/mcs/tso/server/grpc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
func NewService[T ConfigProvider](svr bs.Server) registry.RegistrableService {
server, ok := svr.(*Server)
if !ok {
log.Fatal("create tso server failed")
log.Panic("create tso server failed")

Check warning on line 68 in pkg/mcs/tso/server/grpc_service.go

View check run for this annotation

Codecov / codecov/patch

pkg/mcs/tso/server/grpc_service.go#L68

Added line #L68 was not covered by tests
}
return &Service{
Server: server,
Expand Down
4 changes: 2 additions & 2 deletions pkg/mcs/tso/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@
if err == nil {
log.ReplaceGlobals(cfg.Logger, cfg.LogProps)
} else {
log.Fatal("initialize logger error", errs.ZapError(err))
log.Panic("initialize logger error", errs.ZapError(err))

Check warning on line 468 in pkg/mcs/tso/server/server.go

View check run for this annotation

Codecov / codecov/patch

pkg/mcs/tso/server/server.go#L468

Added line #L468 was not covered by tests
}
// Flushing any buffered log entries
log.Sync()
Expand Down Expand Up @@ -493,7 +493,7 @@
}()

if err := svr.Run(); err != nil {
log.Fatal("run server failed", errs.ZapError(err))
log.Panic("run server failed", errs.ZapError(err))

Check warning on line 496 in pkg/mcs/tso/server/server.go

View check run for this annotation

Codecov / codecov/patch

pkg/mcs/tso/server/server.go#L496

Added line #L496 was not covered by tests
}

<-ctx.Done()
Expand Down
6 changes: 3 additions & 3 deletions pkg/mcs/utils/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
if s.IsClosed() {
log.Info("grpc server stopped")
} else {
log.Fatal("grpc server stopped unexpectedly", errs.ZapError(err))
log.Panic("grpc server stopped unexpectedly", errs.ZapError(err))

Check warning on line 200 in pkg/mcs/utils/util.go

View check run for this annotation

Codecov / codecov/patch

pkg/mcs/utils/util.go#L200

Added line #L200 was not covered by tests
}
}

Expand All @@ -210,7 +210,7 @@
if s.IsClosed() {
log.Info("http server stopped")
} else {
log.Fatal("http server stopped unexpectedly", errs.ZapError(err))
log.Panic("http server stopped unexpectedly", errs.ZapError(err))

Check warning on line 213 in pkg/mcs/utils/util.go

View check run for this annotation

Codecov / codecov/patch

pkg/mcs/utils/util.go#L213

Added line #L213 was not covered by tests
}
}

Expand Down Expand Up @@ -257,7 +257,7 @@
if s.IsClosed() {
log.Info("mux stopped serving", errs.ZapError(err))
} else {
log.Fatal("mux stopped serving unexpectedly", errs.ZapError(err))
log.Panic("mux stopped serving unexpectedly", errs.ZapError(err))

Check warning on line 260 in pkg/mcs/utils/util.go

View check run for this annotation

Codecov / codecov/patch

pkg/mcs/utils/util.go#L260

Added line #L260 was not covered by tests
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/member/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@
data, err := leader.Marshal()
if err != nil {
// can't fail, so panic here.
log.Fatal("marshal pd leader meet error", zap.Stringer("pd-leader", leader), errs.ZapError(errs.ErrMarshalLeader, err))
log.Panic("marshal pd leader meet error", zap.Stringer("pd-leader", leader), errs.ZapError(errs.ErrMarshalLeader, err))

Check warning on line 344 in pkg/member/member.go

View check run for this annotation

Codecov / codecov/patch

pkg/member/member.go#L344

Added line #L344 was not covered by tests
}
m.member = leader
m.memberValue = string(data)
Expand Down
2 changes: 1 addition & 1 deletion pkg/member/participant.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
data, err := p.Marshal()
if err != nil {
// can't fail, so panic here.
log.Fatal("marshal leader meet error", zap.String("member-name", p.String()), errs.ZapError(errs.ErrMarshalLeader, err))
log.Panic("marshal leader meet error", zap.String("member-name", p.String()), errs.ZapError(errs.ErrMarshalLeader, err))

Check warning on line 85 in pkg/member/participant.go

View check run for this annotation

Codecov / codecov/patch

pkg/member/participant.go#L85

Added line #L85 was not covered by tests
}
m.member = p
m.memberValue = string(data)
Expand Down
2 changes: 1 addition & 1 deletion pkg/memory/meminfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@

func mustNil(err error) {
if err != nil {
log.Fatal("unexpected error", zap.Error(err), zap.Stack("stack"))
log.Panic("unexpected error", zap.Error(err), zap.Stack("stack"))

Check warning on line 161 in pkg/memory/meminfo.go

View check run for this annotation

Codecov / codecov/patch

pkg/memory/meminfo.go#L161

Added line #L161 was not covered by tests
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/schedule/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@
log.Error("cannot load schedulers' config", zap.Int("retry-times", i), errs.ZapError(err))
}
if err != nil {
log.Fatal("cannot load schedulers' config", errs.ZapError(err))
log.Panic("cannot load schedulers' config", errs.ZapError(err))

Check warning on line 433 in pkg/schedule/coordinator.go

View check run for this annotation

Codecov / codecov/patch

pkg/schedule/coordinator.go#L433

Added line #L433 was not covered by tests
}
scheduleCfg := c.cluster.GetSchedulerConfig().GetScheduleConfig().Clone()
// The new way to create scheduler with the independent configuration.
Expand Down
2 changes: 1 addition & 1 deletion pkg/schedule/schedulers/base_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
case zeroGrowth:
return x
default:
log.Fatal("type error", errs.ZapError(errs.ErrInternalGrowth))
log.Panic("type error", errs.ZapError(errs.ErrInternalGrowth))

Check warning on line 56 in pkg/schedule/schedulers/base_scheduler.go

View check run for this annotation

Codecov / codecov/patch

pkg/schedule/schedulers/base_scheduler.go#L56

Added line #L56 was not covered by tests
}
return 0
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/schedule/schedulers/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
// func of a package.
func RegisterScheduler(typ string, createFn CreateSchedulerFunc) {
if _, ok := schedulerMap[typ]; ok {
log.Fatal("duplicated scheduler", zap.String("type", typ), errs.ZapError(errs.ErrSchedulerDuplicated))
log.Panic("duplicated scheduler", zap.String("type", typ), errs.ZapError(errs.ErrSchedulerDuplicated))

Check warning on line 123 in pkg/schedule/schedulers/scheduler.go

View check run for this annotation

Codecov / codecov/patch

pkg/schedule/schedulers/scheduler.go#L123

Added line #L123 was not covered by tests
}
schedulerMap[typ] = createFn
}
Expand All @@ -129,7 +129,7 @@
// func of package.
func RegisterSliceDecoderBuilder(typ string, builder ConfigSliceDecoderBuilder) {
if _, ok := schedulerArgsToDecoder[typ]; ok {
log.Fatal("duplicated scheduler", zap.String("type", typ), errs.ZapError(errs.ErrSchedulerDuplicated))
log.Panic("duplicated scheduler", zap.String("type", typ), errs.ZapError(errs.ErrSchedulerDuplicated))

Check warning on line 132 in pkg/schedule/schedulers/scheduler.go

View check run for this annotation

Codecov / codecov/patch

pkg/schedule/schedulers/scheduler.go#L132

Added line #L132 was not covered by tests
}
schedulerArgsToDecoder[typ] = builder
config.RegisterScheduler(typ)
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/hot_region_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ func newTestHotRegionStorage(pullInterval time.Duration,
func PrintDirSize(path string) {
size, err := DirSizeB(path)
if err != nil {
log.Fatal(err)
log.Panic(err)
}
fmt.Printf("file size %d\n", size)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/syncer/history_buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
if v != "" {
h.index, err = strconv.ParseUint(v, 10, 64)
if err != nil {
log.Fatal("load history index failed", errs.ZapError(errs.ErrStrconvParseUint, err))
log.Panic("load history index failed", errs.ZapError(errs.ErrStrconvParseUint, err))

Check warning on line 151 in pkg/syncer/history_buffer.go

View check run for this annotation

Codecov / codecov/patch

pkg/syncer/history_buffer.go#L151

Added line #L151 was not covered by tests
}
}
log.Info("start from history index", zap.Uint64("start-index", h.firstIndex()))
Expand Down
2 changes: 1 addition & 1 deletion pkg/tso/keyspace_group_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@
cfg ServiceConfig,
) *KeyspaceGroupManager {
if mcsutils.MaxKeyspaceGroupCountInUse > mcsutils.MaxKeyspaceGroupCount {
log.Fatal("MaxKeyspaceGroupCountInUse is larger than MaxKeyspaceGroupCount",
log.Panic("MaxKeyspaceGroupCountInUse is larger than MaxKeyspaceGroupCount",

Check warning on line 407 in pkg/tso/keyspace_group_manager.go

View check run for this annotation

Codecov / codecov/patch

pkg/tso/keyspace_group_manager.go#L407

Added line #L407 was not covered by tests
zap.Uint32("max-keyspace-group-count-in-use", mcsutils.MaxKeyspaceGroupCountInUse),
zap.Uint32("max-keyspace-group-count", mcsutils.MaxKeyspaceGroupCount))
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/logutil/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
// Commonly used with a `defer`.
func LogPanic() {
if e := recover(); e != nil {
log.Fatal("panic", zap.Reflect("recover", e))
log.Panic("panic", zap.Reflect("recover", e))

Check warning on line 93 in pkg/utils/logutil/log.go

View check run for this annotation

Codecov / codecov/patch

pkg/utils/logutil/log.go#L93

Added line #L93 was not covered by tests
}
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/utils/tempurl/tempurl.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}
time.Sleep(time.Second)
}
log.Fatal("failed to alloc test URL")
log.Panic("failed to alloc test URL")

Check warning on line 46 in pkg/utils/tempurl/tempurl.go

View check run for this annotation

Codecov / codecov/patch

pkg/utils/tempurl/tempurl.go#L46

Added line #L46 was not covered by tests
return ""
}

Expand All @@ -53,12 +53,12 @@
}
l, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
log.Fatal("listen failed", errs.ZapError(err))
log.Panic("listen failed", errs.ZapError(err))

Check warning on line 56 in pkg/utils/tempurl/tempurl.go

View check run for this annotation

Codecov / codecov/patch

pkg/utils/tempurl/tempurl.go#L56

Added line #L56 was not covered by tests
}
addr := fmt.Sprintf("http://%s", l.Addr())
err = l.Close()
if err != nil {
log.Fatal("close failed", errs.ZapError(err))
log.Panic("close failed", errs.ZapError(err))

Check warning on line 61 in pkg/utils/tempurl/tempurl.go

View check run for this annotation

Codecov / codecov/patch

pkg/utils/tempurl/tempurl.go#L61

Added line #L61 was not covered by tests
}

testAddrMutex.Lock()
Expand Down
2 changes: 1 addition & 1 deletion pkg/versioninfo/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
func MinSupportedVersion(v Feature) *semver.Version {
target, ok := featuresDict[v]
if !ok {
log.Fatal("the corresponding version of the feature doesn't exist", zap.Int("feature-number", int(v)), errs.ZapError(errs.ErrFeatureNotExisted))
log.Panic("the corresponding version of the feature doesn't exist", zap.Int("feature-number", int(v)), errs.ZapError(errs.ErrFeatureNotExisted))
}

Check warning on line 70 in pkg/versioninfo/feature.go

View check run for this annotation

Codecov / codecov/patch

pkg/versioninfo/feature.go#L69-L70

Added lines #L69 - L70 were not covered by tests
version := MustParseVersion(target)
return version
}
2 changes: 1 addition & 1 deletion pkg/versioninfo/versioninfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func ParseVersion(v string) (*semver.Version, error) {
func MustParseVersion(v string) *semver.Version {
ver, err := ParseVersion(v)
if err != nil {
log.Fatal("version string is illegal", errs.ZapError(err))
log.Panic("version string is illegal", errs.ZapError(err))
}
return ver
}
Expand Down
2 changes: 1 addition & 1 deletion server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@
defer tick.Stop()
totalMem, err := memory.MemTotal()
if err != nil {
log.Fatal("fail to get total memory:%s", zap.Error(err))
log.Panic("fail to get total memory:%s", zap.Error(err))

Check warning on line 424 in server/cluster/cluster.go

View check run for this annotation

Codecov / codecov/patch

server/cluster/cluster.go#L424

Added line #L424 was not covered by tests
}
log.Info("memory info", zap.Uint64("total-mem", totalMem))
cfg := c.opt.GetPDServerConfig()
Expand Down
2 changes: 1 addition & 1 deletion server/join/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
if _, err := os.Stat(filePath); !os.IsNotExist(err) {
s, err := os.ReadFile(filePath)
if err != nil {
log.Fatal("read the join config meet error", errs.ZapError(errs.ErrIORead, err))
log.Panic("read the join config meet error", errs.ZapError(errs.ErrIORead, err))

Check warning on line 98 in server/join/join.go

View check run for this annotation

Codecov / codecov/patch

server/join/join.go#L98

Added line #L98 was not covered by tests
}
cfg.InitialCluster = strings.TrimSpace(string(s))
cfg.InitialClusterState = embed.ClusterStateFlagExisting
Expand Down
4 changes: 2 additions & 2 deletions tools/pd-analysis/analysis/parse_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@
if pattern, ok := supportLayouts[layout]; ok {
r, err = regexp.Compile(pattern)
if err != nil {
log.Fatal(err)
log.Panic(err)

Check warning on line 133 in tools/pd-analysis/analysis/parse_log.go

View check run for this annotation

Codecov / codecov/patch

tools/pd-analysis/analysis/parse_log.go#L133

Added line #L133 was not covered by tests
}
} else {
log.Fatal("unsupported time layout")
log.Panic("unsupported time layout")

Check warning on line 136 in tools/pd-analysis/analysis/parse_log.go

View check run for this annotation

Codecov / codecov/patch

tools/pd-analysis/analysis/parse_log.go#L136

Added line #L136 was not covered by tests
}
return func(content string) (time.Time, error) {
result := r.FindStringSubmatch(content)
Expand Down
Loading
Loading