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

不影响存量代码的增量代码会导致无法merge #397

Open
dumbFeng opened this issue Jan 20, 2025 · 0 comments
Open

不影响存量代码的增量代码会导致无法merge #397

dumbFeng opened this issue Jan 20, 2025 · 0 comments

Comments

@dumbFeng
Copy link

dumbFeng commented Jan 20, 2025

代码版本1:

23 func (svc *CoverService) Hello(ctx context.Context, params *request.CoverHelloReq) int {
24	var ret int
25	if true {
26		ret = 1 + 2
27	}
28
29	return ret
30 }

代码覆盖profile:

xxx.go:23.88,25.10 2 1
xxx.go:25.10,27.3 1 1
xxx.go:29.2,29.12 1 1

在Hello下面新增Hello2的实现,得到代码版本2:

23 func (svc *CoverService) Hello(ctx context.Context, params *request.CoverHelloReq) int {
24	var ret int
25	if true {
26		ret = 1 + 2
27	}
28
29	return ret
30 }
31
32 func (svc *CoverService) Hello2(ctx context.Context, params *request.CoverHelloReq) int {
33	var ret int
34	if true {
35		ret = 1 + 2
36	}
37
38	return ret
39 }

得到的代码覆盖profile如下:

xxx.go:23.88,25.10 2 0
xxx.go:25.10,27.3 1 0
xxx.go:29.2,29.12 1 0
xxx.go:32.89,34.10 2 0
xxx.go:34.10,36.3 1 0
xxx.go:38.2,38.12 1 0

此时使用goc merge合并两份profile数据,因为block数不一致,会报错。但是此时我们希望能够合并,且合并后的profile应该如下:
xxx.go:23.88,25.10 2 1
xxx.go:25.10,27.3 1 1
xxx.go:29.2,29.12 1 1
xxx.go:32.89,34.10 2 0
xxx.go:34.10,36.3 1 0
xxx.go:38.2,38.12 1 0


大佬们,有没有办法支持?
@dumbFeng dumbFeng changed the title 不影响存量代码的增量代码会导致整个文件的存量覆盖数据失效 不影响存量代码的增量代码会导致无法merge Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant