-
Notifications
You must be signed in to change notification settings - Fork 6
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
jsonc docker image on docker hub? #4
Comments
I am not sure if I follow. jsonc is just a go module which can be used as a dependency in go projects. |
Hmmm I was referring to the |
What would you need from my side to make this work? |
@komkom sorry for the late response on this... I'm not a golang user so I just modified the sample Dockerfile from the official golang docker image. It appears to run fine with the alpine image so I've used that for faster runtime. # could also use golang:alpine here if specific version is not required
FROM golang:1.16-alpine
# get the latest alpine security updates
RUN apk --no-cache upgrade
WORKDIR /go/src/app
COPY . .
RUN go get -d -v ./...; \
go install -v ./...
# is it possible to change the built executable from `cmd` to `jsonc`?
ENTRYPOINT ["/go/bin/cmd"] Then you can create an account on docker hub and connect it to your github repository here to enable automatic builds of the docker images each time you push commits to github. The only thing missing here is that |
I should have also mentioned earlier that my use case here is for linting the vscode devcontainer.json file which appears to be just regular json with javascript-style I would probably be just using |
I guess I found the bug in cmd/main.go. I pushed a commit to master, now you should get a correct error code in the error case. |
Thanks for the quick fix. I can't seem to trigger the error code. When I run a test on https://komkom.github.io/ with the contents of (including newline):
I get an error of
which seems correct. However when I install locally I can't trigger any non-zero exit code. Installed with the latest go get github.com/komkom/jsonc/... and running jsonc with
It doesn't exit with a non-zero exit code and seems to just output just the valid part of the jsonc file, ignoring any invalid file contents. Have I missed a step somewhere here? |
Ok can you send me the invalid test.jsonc file. Best would be a short version to check? |
I just created the file with echo "{{" > test.jsonc |
Yes you are right error handling was missing for the cli version. I simplified the cmd pkg now. When testing with your file and with a valid file it works now. Can you double check? |
Thanks, I can get the exit code |
Ok thanks will take a look. But it will probably take a while. |
Thanks. Meanwhile, I have built a docker image locally from the PR Dockerfile and have run a successful test using jsonc in a docker agent with Jenkins to do some basic linting on a json file with comments! Thanks again for providing a useful tool. |
It would be nice to have a jsonc image on docker hub that could be easily used in CI environments, to easily convert jsonc to regular json.
There is a PR for
jq
that should provide an example of how to implement.It looks like from reading that PR that you could then enable auto-builds on docker hub that would automatically build a new docker image on hub.docker.com when code is committed to this github repository.
The text was updated successfully, but these errors were encountered: