Repository navigation
Add go.mod - #1326
Add go.mod#1326
Conversation
tianon
left a comment
There was a problem hiding this comment.
Does anyone use "validate" enough to make this worthwhile to maintain?
|
|
||
| go 1.21 | ||
|
|
||
| require github.com/xeipuuv/gojsonschema v1.2.0 |
There was a problem hiding this comment.
We should look if we can rewrite this to github.com/santhosh-tekuri/jsonschema/v6. This module is no longer maintained (I can have a look if it's an easy rewrite)
There was a problem hiding this comment.
- ☝️ opened a quick follow-up for that; schema/validate: migrate to santhosh-tekuri/jsonschema/v6 #1327
Good question as well; at least it's good to give it its own |
Yeah, it was for things like 869b2d5 (#1279), which was a breaking change at least from the Go API side (and definitely caused some breakage down the line), so would've warranted a V2. It's the tricky bit of trying to version two distinct API stabilities (Go API vs spec API) into a single tag. Given that the spec version is already captured in code, technically we could have them separate runtime-spec/specs-go/version.go Lines 5 to 15 in fbb4178 |
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM on having a go.mod; the "module version must match specs version" is still something to slightly consider though.
AkihiroSuda
left a comment
There was a problem hiding this comment.
Added this to v1.3.1 milestone, but maybe we should skip it and bump the version to v1.4
|
Image-spec had a similar update a while back. It may make sense to move the validate code to a common location. If there's interest in doing that, we could open an issue with the TOB to setup a new repo and maintainers. |
|
overall, I think a "sub" module in this repo is OK; I think it's used in CI to verify the json-schemas are done correctly, and it's .. very little code; bit on the fence on moving to a separate repo, as the amount of boiler-plating / maintenance to keep that up may be more than the little amount of code in it (at a quick glance). |
The old way of building the validator (go get $DEPS && go build) no longer works since Go 1.22: go: go.mod file not found in current directory or any parent directory. 'go get' is no longer supported outside a module. Move the validator sources into their own directory, with own go.mod. This fixes the build, makes it possible to use go install, and, since it is a separate module, its dependencies (gojsonschema) won't end up as dependencies of github.com/opencontainers/runtime-spec once it gets its own go.mod. Fix build and test commands in README and Makefile accordingly (and there's no need to run go get any more). Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Since there is no go.mod, CI has to create one on the fly (using "go mod init" and "go get"). In addition, "make docs" no longer works with Go 1.23+, since "go run ./.tool/version-doc.go" requires a module. Add go.mod (with no dependencies, and the go directive set to the minimal Go version we support and test with), and remove the go.mod creation from CI. Since schema/validate is now a separate module, run golangci-lint for it separately. To avoid using golangci-lint-action twice, bump it to v9 and use its install-only mode, running golangci-lint directly. Fixes opencontainers#1280. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Since there is no
go.mod, CI creates one on the fly usinggo mod initandgo get. In addition,make docsdoesn't work with Go 1.23+ (#1280), and the schema validator can't be built with Go 1.22+ (go getis no longer supported outside a module).This PR:
schema/validate), so that its dependency (gojsonschema) does not become a dependency ofgithub.com/opencontainers/runtime-spec.go.modwith no dependencies, and thegodirective set to the minimal Go version we support and test with (1.21), and removesgo.modcreation from CI.(if #1325 is merged first, it's trivial to rebase this one)
For users of
specs-go, nothing changes: the module path stays the same, and there are no new dependencies.Fixes #1280.
Previously: #1068 was closed in favor of #1069 (making
specs-goa separate module with its own tags), which has not happened since 2020. As noted in #1069 (comment), the Go code here is just struct definitions and constants, so separate Go releases are unlikely to be needed; image-spec also hasgo.modat the top level.