Skip to content

Commit 14fa848

Browse files
committed
Determine schemas path on demand
Rather than determining the schemas path once at initialization and storing it in a package variable, determine it on demand when the getter function is called.
1 parent cb43cc2 commit 14fa848

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Diff for: check/checkdata/schema/schema.go

+2-8
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,10 @@ import (
1010
"github.com/xeipuuv/gojsonschema"
1111
)
1212

13-
var schemasPath *paths.Path
14-
15-
func init() {
16-
workingPath, _ := os.Getwd()
17-
schemasPath = paths.New(workingPath)
18-
}
19-
2013
// SchemasPath returns the path to the folder containing the JSON schemas.
2114
func SchemasPath() *paths.Path {
22-
return schemasPath
15+
workingPath, _ := os.Getwd()
16+
return paths.New(workingPath)
2317
}
2418

2519
// Compile compiles the schema files specified by the filename arguments and returns the compiled schema.

0 commit comments

Comments
 (0)