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

refactor func splitStructName #1313

Merged
merged 3 commits into from Aug 31, 2022
Merged

refactor func splitStructName #1313

merged 3 commits into from Aug 31, 2022

Conversation

sdghchj
Copy link
Member

@sdghchj sdghchj commented Aug 30, 2022

Just reimplement the func splitStructName with std functions in library strings

chengjin added 3 commits August 30, 2022 11:23
Signed-off-by: sdghchj <chengjin@cmiot.chinamobile.com>
Signed-off-by: sdghchj <chengjin@cmiot.chinamobile.com>
Signed-off-by: sdghchj <chengjin@cmiot.chinamobile.com>
@codecov
Copy link

codecov bot commented Aug 30, 2022

Codecov Report

Merging #1313 (febba55) into master (cf1c4a7) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1313   +/-   ##
=======================================
  Coverage   95.61%   95.61%           
=======================================
  Files          14       14           
  Lines        2851     2851           
=======================================
  Hits         2726     2726           
  Misses         70       70           
  Partials       55       55           
Impacted Files Coverage Δ
generics.go 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

lastParam = ""
depth := 0
genericParams = strings.FieldsFunc(genericParams[1], func(r rune) bool {
if r == '[' {
Copy link
Contributor

@ubogdan ubogdan Aug 30, 2022

Choose a reason for hiding this comment

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

I think it's more elegant with a switch case

	switch r {
	case '[':
		depth++
	case ']':
		depth--
	case ',':
		if depth == 0 {
			return true
		}
	default:
		return false
	}

Copy link
Contributor

@ubogdan ubogdan left a comment

Choose a reason for hiding this comment

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

LGTM

@sdghchj sdghchj merged commit e7ccdf4 into master Aug 31, 2022
@sdghchj sdghchj deleted the refactor_splitStructName branch August 31, 2022 01:08
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

Successfully merging this pull request may close these issues.

None yet

2 participants