Skip to content

Commit

Permalink
Add golagnci lint
Browse files Browse the repository at this point in the history
  • Loading branch information
RealAlexandreAI committed Apr 29, 2024
1 parent e34ac0d commit defa891
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go-version: ['1.11','1.12','1.13','1.14','1.15','1.16','1.17','1.18', '1.19', '1.20', '1.21', '1.22']
go-version: ['1.18', '1.19', '1.20', '1.21', '1.22']
env:
VERBOSE: 1

Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: golangci-lint
on:
push:
branches:
- main
- master
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read
pull-requests: read
checks: write

jobs:
golangci:
strategy:
matrix:
go: ['1.18', '1.19', '1.20', '1.21', '1.22']
os: [macos-latest, windows-latest]
name: lint
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v5
with:
version: v1.57
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

- Enhance README
- Add golangci-lint

## v0.0.6

- Use bytes.IndexByte instead of Contains
- fix upstream #29
- Split MustRepairJSON
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<p align="center">
JSON Repair: Solution for JSON Anomalies from LLMs.
<br />
<a href="https://goplay.tools/snippet/tKNwcBIsAMV">Online Playground</a>
<a href="https://goplay.tools/snippet/zyLfsLcsTwg">Online Playground</a>
·
<a href="https://github.com/RealAlexandreAI/json-repair/issues/new?labels=bug&template=bug-report---.md">Report Bug</a>
·
Expand Down Expand Up @@ -117,8 +117,9 @@ func main() {
}
```

> Additionally, there is `MustRepairJSON` for scenarios that are not suitable for error handling, such as pipes and trusted environments
_For more examples, please refer to the [Test Cases](https://github.com/RealAlexandreAI/json-repair/blob/master/main_test.go) Or <a href="https://goplay.tools/snippet/tKNwcBIsAMV">Online Playground</a>_
_For more examples, please refer to the [Test Cases](https://github.com/RealAlexandreAI/json-repair/blob/master/main_test.go) Or <a href="https://goplay.tools/snippet/zyLfsLcsTwg">Online Playground</a>_

<p align="right">(<a href="#readme-top">back to top</a>)</p>

Expand Down
6 changes: 3 additions & 3 deletions cli/jsonrepair-cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/RealAlexandreAI/json-repair"
)

const AppVersion = "0.0.5"
const AppVersion = "0.0.6"

var (
versionFlag bool
Expand Down Expand Up @@ -53,7 +53,7 @@ func main() {
}

if input != "" {
fmt.Println(jsonrepair.RepairJSON(input))
fmt.Println(jsonrepair.MustRepairJSON(input))
}

if file != "" {
Expand All @@ -68,6 +68,6 @@ func main() {
fmt.Println()
return
}
fmt.Println(jsonrepair.RepairJSON(string(fi)))
fmt.Println(jsonrepair.MustRepairJSON(string(fi)))
}
}

0 comments on commit defa891

Please sign in to comment.