Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ianfixes/04dc060fecb2c3993907634e5a7aebf0 to your computer and use it in GitHub Desktop.
Save ianfixes/04dc060fecb2c3993907634e5a7aebf0 to your computer and use it in GitHub Desktop.
Convert colon-delimited linting report to GitHub Annotations format
# Pretty sure this will work,
run:
- |
gofmt -l . 2>&1
| jq -Rn '[
inputs
| split(":")
| {
"path": .[0],
"start_line": (.[1] | tonumber),
"end_line": (.[1] | tonumber),
"start_column": (.[2] | tonumber),
"end_column": (.[2] | tonumber),
"annotation_level": "failure",
"annotation": (.[3:]|join(":")|gsub("^ +| +$";""))
}
]' > annotations.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment