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

Validate return err on golang 1.19 #360

Open
CharlesQQ opened this issue Feb 23, 2023 · 1 comment
Open

Validate return err on golang 1.19 #360

CharlesQQ opened this issue Feb 23, 2023 · 1 comment

Comments

@CharlesQQ
Copy link

As following code example, gojsonschema.Validate return err open file:/Users/momo/go/src/ch/redis-inspector/build.json: no such file or directory, but file /Users/momo/go/src/ch/redis-inspector/build.sh exist

func main() {
	shemaPath := path.Join("file://", "/Users/momo/go/src/ch", "redis-inspector/build.json")
	shemaLoader := gojsonschema.NewReferenceLoader(shemaPath)
	var  input  string =  ""
	dataLoader := gojsonschema.NewGoLoader(input)
	result, err := gojsonschema.Validate(shemaLoader, dataLoader)
	fmt.Println(result, err)
}
@fpeterschmitt
Copy link

fpeterschmitt commented Mar 15, 2023

it is not a problem with the library: in recent versions of go, you must take file:// out of the path.Join:

"file://" + path.Join("/User....", "redis...")

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

2 participants