Skip to content

Commit

Permalink
优化给零值赋值参数的逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
yangyile committed Dec 17, 2024
1 parent aea050e commit 4686aa1
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
path-to-profile: /tmp/coverage/combined.txt
flag-name: Go-${{ matrix.go }}
parallel: true
if: ${{ github.event.repository.fork == false }} # 仅在非 fork 时上传覆盖率

check-coverage:
name: Check coverage
Expand All @@ -51,14 +52,15 @@ jobs:
- uses: shogo82148/actions-goveralls@v1
with:
parallel-finished: true
if: ${{ github.event.repository.fork == false }} # 仅在非 fork 时检查覆盖率

# 发布 Release
release:
name: Release a new version
needs: [ lint, test ]
runs-on: ubuntu-latest
# 仅在推送标签时执行
if: ${{ success() && startsWith(github.ref, 'refs/tags/v') }}
# 仅在推送标签时执行 - && - 仅在非 fork 时执行发布
if: ${{ github.event.repository.fork == false && success() && startsWith(github.ref, 'refs/tags/v') }}
steps:
# 1. 检出代码
- name: Checkout code
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ require (
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.10.0
github.com/yyle88/done v1.0.18
github.com/yyle88/erero v1.0.14
github.com/yyle88/formatgo v1.0.19
github.com/yyle88/must v0.0.9
github.com/yyle88/erero v1.0.15
github.com/yyle88/formatgo v1.0.21
github.com/yyle88/must v0.0.10
github.com/yyle88/printgo v1.0.1
github.com/yyle88/rese v0.0.1
github.com/yyle88/rese v0.0.2
github.com/yyle88/runpath v1.0.22
github.com/yyle88/syntaxgo v0.0.39
github.com/yyle88/tern v0.0.3
github.com/yyle88/syntaxgo v0.0.43
github.com/yyle88/tern v0.0.4
github.com/yyle88/zaplog v0.0.16
go.uber.org/zap v1.27.0
)
Expand All @@ -26,7 +26,7 @@ require (
github.com/rogpeppe/go-internal v1.13.1 // indirect
github.com/yyle88/mutexmap v1.0.8 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d // indirect
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/tools v0.28.0 // indirect
Expand Down
28 changes: 14 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/yyle88/done v1.0.18 h1:O71T+76laNmuY1kYP8PHkp6uceoN6ABTng/8c9KpZts=
github.com/yyle88/done v1.0.18/go.mod h1:32UMgjuZP9LctfNNhBQqTyVbjggPOWpoXn8Mp0VrQbw=
github.com/yyle88/erero v1.0.14 h1:ozS3iPLIsnRPSs8AdfbA/3f3hGw5EFkJMkfA/dfI+do=
github.com/yyle88/erero v1.0.14/go.mod h1:NhP5EcPoVlShkMk1cVCFP3im5Zm+JRG35qIInMw7aeo=
github.com/yyle88/formatgo v1.0.19 h1:XgcSB8KsGLTnv7UOCVZDtrd3yJggFd2J82xG5qvmdFI=
github.com/yyle88/formatgo v1.0.19/go.mod h1:Q+JpNGVgskW2Xl+BdHXZ7r6y6TQlQOyN7/23Gu/wzoM=
github.com/yyle88/must v0.0.9 h1:LA03i1O4/6Syopma8xqJMiWfAWeehoySeUaRmdQEvKY=
github.com/yyle88/must v0.0.9/go.mod h1:5Ur4BKRx6GuW4gCZNx8Hf+iRS9lVmywSkCpxun/f+Do=
github.com/yyle88/erero v1.0.15 h1:W3v1eIfX1m2YxYwAAtHky/T0FkreAh87/VZU/xMOFgY=
github.com/yyle88/erero v1.0.15/go.mod h1:NhP5EcPoVlShkMk1cVCFP3im5Zm+JRG35qIInMw7aeo=
github.com/yyle88/formatgo v1.0.21 h1:YPhZf63/f+R1JayJ0Cbnqbc9P/9OJOaYJJpwAhMNdtE=
github.com/yyle88/formatgo v1.0.21/go.mod h1:6lkm0Jk3XfDKIMtcUqc01DcLVXcKaLTYIkWbQbsDCzU=
github.com/yyle88/must v0.0.10 h1:pvxIpS+KxIZbam2n7/TDbkhr5xbGYXqDHEND1FCi2EQ=
github.com/yyle88/must v0.0.10/go.mod h1:5Ur4BKRx6GuW4gCZNx8Hf+iRS9lVmywSkCpxun/f+Do=
github.com/yyle88/mutexmap v1.0.8 h1:VntAdXID5wbk211LZEPVK96jQBxIcfVIbQuk9cv3P/8=
github.com/yyle88/mutexmap v1.0.8/go.mod h1:QUYDuARLPlGj414kHewQ5tt8jkDxQXoai8H3C4Gg+yc=
github.com/yyle88/printgo v1.0.1 h1:0lCpq28Tlf0jmYhSIlDQ7A3hAqVYswhBuURLR9xbmsw=
github.com/yyle88/printgo v1.0.1/go.mod h1:yCvpShGBkKdWX5RO+yum2gLbru9ebc04sVmuzhPKSMw=
github.com/yyle88/rese v0.0.1 h1:Eu2I+7BpbkX1n7SOu11AHVqecTuOVdg4becgt2ThGIo=
github.com/yyle88/rese v0.0.1/go.mod h1:GoPiHJPEWyeBL0DxOHT5hLnibFbav+jck/NZxLqNVI8=
github.com/yyle88/rese v0.0.2 h1:UdD5rc2DASd0RAJ322aptWX49keA7j/dvcJmVyreLqg=
github.com/yyle88/rese v0.0.2/go.mod h1:wO23ottjYYp8U+8AFwlTbiHHpxpc9TFYXfjIcN/7szQ=
github.com/yyle88/runpath v1.0.22 h1:gcyaNMNZq7yjL2Xlwvs0W7BOkzn4VJTJqA8ko7CKhKg=
github.com/yyle88/runpath v1.0.22/go.mod h1:JRGxn/0Ytg6CvGoE2VrO74oX8Lu4jbOPZDKxr8tzPEg=
github.com/yyle88/syntaxgo v0.0.39 h1:947UHHAqGsHAmS7nJ5Y/Br+yhJjTZtq1543XIizfevI=
github.com/yyle88/syntaxgo v0.0.39/go.mod h1:vR/bU2RVwvkfkQyMy30OWpdmn5jc3wrm8vcMbHQGCbc=
github.com/yyle88/tern v0.0.3 h1:Ut5p1wPAVcreEkmzDp+IiteA3K2vnTeAYE1PyBLNgjU=
github.com/yyle88/tern v0.0.3/go.mod h1:g9weyOMLtXYyt37EAshZPUTTHdH7WFauuxDi4oPr7/8=
github.com/yyle88/syntaxgo v0.0.43 h1:G5x7J0br8XvSxytAJJL/DQQ968HSoPBMyNTQ3NpBdII=
github.com/yyle88/syntaxgo v0.0.43/go.mod h1:rmapSvQHkPMsIBYXNa/a4i/31vVGbO0Bt6MOyg00TLs=
github.com/yyle88/tern v0.0.4 h1:PFirncRmdzpMZl6G41Z0Ihmx/XB6PdSQWAHa4a1+PQk=
github.com/yyle88/tern v0.0.4/go.mod h1:g9weyOMLtXYyt37EAshZPUTTHdH7WFauuxDi4oPr7/8=
github.com/yyle88/zaplog v0.0.16 h1:ZCxQhq3+nWeWMAXIzeA1EA4exRq5Pn8pXTpEw1GjyD4=
github.com/yyle88/zaplog v0.0.16/go.mod h1:0ct8Rh6uE5i9RG+xbH6d4/pyDBt9JmxBqHNCI+T4wiM=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
Expand All @@ -45,8 +45,8 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d h1:0olWaB5pg3+oychR51GUVCEsGkeCU/2JxjBgIo4f3M0=
golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c=
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 h1:1UoZQm6f0P/ZO0w1Ri+f+ifG/gXhegadRdwBIXEFWDo=
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c=
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
Expand Down
2 changes: 1 addition & 1 deletion sure_cls_gen/cls_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func GenerateClassWithErrorHandlingMode(cfg *ClassGenOptions, object interface{}
}

// when zero - set a new value
zerotern.PF(&cfg.ReceiverVariableName, func() string {
zerotern.SetPF(&cfg.ReceiverVariableName, func() string {
return zerotern.VV(sourceMethodsTuples.GetReceiverVariableName(), "T")
})

Expand Down

0 comments on commit 4686aa1

Please sign in to comment.