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

walk func does not consider callback return params #25

Closed
ecoshub opened this issue Jun 30, 2022 · 0 comments
Closed

walk func does not consider callback return params #25

ecoshub opened this issue Jun 30, 2022 · 0 comments

Comments

@ecoshub
Copy link
Owner

ecoshub commented Jun 30, 2022

jin walk.go:45
current code:

	default:
		key := ""
		if len(path) != 0 {
			key = path[len(path)-1]
		}
		val, err := Get(json, path...)
		if err != nil {
			return err
		}
		callback(key, val, path) // return control is missing
	}

must change with:

	default:
		key := ""
		if len(path) != 0 {
			key = path[len(path)-1]
		}
		val, err := Get(json, path...)
		if err != nil {
			return err
		}
		cont, err := callback(key, val, path)
		if err != nil {
			return err 
		}
		if !cont {
			return nil
		}
	}
ecoshub pushed a commit that referenced this issue Jun 30, 2022
ecoshub added a commit that referenced this issue Jun 30, 2022
…trol

fix: walk func callback return control #25
@ecoshub ecoshub closed this as completed Jul 10, 2022
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