diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 376ece7..72d59e1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,8 +18,8 @@ jobs: - oldstable runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 + - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 with: go-version: ${{ matrix.go-version }} - name: build @@ -29,7 +29,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 + - uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 with: - version: v2.0.2 + version: v2.4.0 diff --git a/.golangci.yml b/.golangci.yml index b179c0f..6f9f2a0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -14,6 +14,7 @@ linters: - dupl - dupword - durationcheck + - embeddedstructfieldcheck - err113 - errchkjson - errname @@ -22,6 +23,7 @@ linters: - exptostd - fatcontext - forcetypeassert + - funcorder - ginkgolinter - gocheckcompilerdirectives - gochecknoinits @@ -81,6 +83,7 @@ linters: - whitespace - zerologlint disable: + - arangolint - cyclop - depguard - exhaustruct @@ -96,11 +99,13 @@ linters: - mnd - nestif - nlreturn + - noinlineerr - paralleltest - testpackage - varnamelen - wrapcheck - wsl + - wsl_v5 exclusions: generated: lax presets: diff --git a/README.md b/README.md index af15754..d2a36e5 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ which you can try by running echo '{"nested":{"bar":true,"foo":"baz"}}' \ '{"nested":{"bar":false,"foo":null}}' \ '{"nested":{"bar":true,"foo":""}}' \ - | gojsonstruct --package-name mypackage --typename MyType + | gojsonstruct --package-name mypackage --type-name MyType ``` generates the output diff --git a/cmd/gojsonstruct/main.go b/cmd/gojsonstruct/main.go index 1938989..5bbc0e0 100644 --- a/cmd/gojsonstruct/main.go +++ b/cmd/gojsonstruct/main.go @@ -26,7 +26,7 @@ var ( stringTags = pflag.Bool("string-tags", false, "generate ,string tags") structTagName = pflag.String("struct-tag-name", "", "struct tag name") typeComment = pflag.String("type-comment", "", "type comment") - typeName = pflag.String("typename", "T", "type name") + typeName = pflag.String("type-name", "T", "type name") intType = pflag.String("int-type", "", "integer type") useJSONNumber = pflag.Bool("use-json-number", false, "use json.Number") goFormat = pflag.Bool("go-format", true, "format generated Go code") diff --git a/go.mod b/go.mod index b8472be..039bb81 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/alecthomas/assert/v2 v2.6.0 github.com/fatih/camelcase v1.0.0 github.com/fatih/structtag v1.2.0 - github.com/spf13/pflag v1.0.6 + github.com/spf13/pflag v1.0.10 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index db0c609..d03a341 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,8 @@ github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4 github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= -github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= -github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=