Skip to content

MacOS ARM64 兼容性问题 #148

@alpha-baby

Description

@alpha-baby

我本地是 2021款 m1 pro, mac os 13.2.1 (22D68)

go version go1.18.10 darwin/arm64

我把代码最新拉取到本地直接跑项目自带的单测,很多都跑不起来,
比如:

go test -gcflags="all=-l -N" -v -run=^TestApplyMethodFunc$ .
=== RUN   TestApplyMethodFunc

  TestApplyMethodFunc 
    for succ Slice: Add elem: 1 succ
✔✔Slice: Remove elem: 1 succ
✔✔
    for already exist Slice: Add elem: 2 succ
✔Slice: Add elem: 1 succ
✘
    two methods Slice: Add elem: 3 succ
✔✔✔✘Slice: Remove elem: 3 succ

    one func and one method Slice: Add elem: 4 succ
✔✘Slice: Remove elem: 4 succ

    for variadic method Slice: Append elem: [1 2 3] succ
✔✔✔

Failures:

  * /bak/gomonkey/test/apply_method_func_test.go 
  Line 41:
  Expected: 'elem already exist'
  Actual:   '<nil>'
  (Should be equal)
  goroutine 20 [running]:
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/reporting/reports.go:143 +0x50
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/reporting/reports.go:103 +0x98
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:176 +0x8c
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/doc.go:125 +0x58
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc.func1.2()
        /bak/gomonkey/test/apply_method_func_test.go:41 +0x274
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/discovery.go:80 +0x2c
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:261 +0x208
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:163 +0x60
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/context.go:97 +0x4dc
  github.com/jtolds/gls.EnsureGoroutineId(0x140000a4c00)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/gid.go:19 +0x58
  github.com/jtolds/gls.(*ContextManager).SetValues(0x1400008e3a0, 0x140000a4ba0, 0x140000ae2d0)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/context.go:63 +0x230
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:162 +0x63c
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/doc.go:77 +0x48
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc.func1()
        /bak/gomonkey/test/apply_method_func_test.go:33 +0x210
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/discovery.go:80 +0x2c
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:261 +0x208
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:110 +0x164
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/context.go:97 +0x4dc
  github.com/jtolds/gls.EnsureGoroutineId.func1()
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/gid.go:24 +0x38
  github.com/jtolds/gls._m(0x0, 0x140000ae120)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/stack_tags.go:108 +0x38
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x0, 0x140000ae120)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/stack_tags.go:56 +0x28
  github.com/jtolds/gls.addStackTag(0x0, 0x140000ae120)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/stack_tags.go:49 +0x30
  github.com/jtolds/gls.EnsureGoroutineId(0x140000a4630)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/gid.go:24 +0x150
  github.com/jtolds/gls.(*ContextManager).SetValues(0x1400008e3a0, 0x140000a45d0, 0x140000900a0)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/context.go:63 +0x230
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:105 +0x350
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/doc.go:75 +0x5c
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc(0x14000083860)
        /bak/gomonkey/test/apply_method_func_test.go:18 +0x1a0
  testing.tRunner(0x14000083860, 0x10515efd0)
        /.g/versions/1.18.10/src/testing/testing.go:1439 +0x178
  created by testing.(*T).Run
        /.g/versions/1.18.10/src/testing/testing.go:1486 +0x548
  

  * /bak/gomonkey/test/apply_method_func_test.go 
  Line 62:
  Expected: '1'
  Actual:   '3'
  (Should be equal)
  goroutine 20 [running]:
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/reporting/reports.go:143 +0x50
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/reporting/reports.go:103 +0x98
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:176 +0x8c
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/doc.go:125 +0x58
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc.func1.3()
        /bak/gomonkey/test/apply_method_func_test.go:62 +0x4a4
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/discovery.go:80 +0x2c
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:261 +0x208
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:163 +0x60
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/context.go:97 +0x4dc
  github.com/jtolds/gls.EnsureGoroutineId(0x140000a50b0)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/gid.go:19 +0x58
  github.com/jtolds/gls.(*ContextManager).SetValues(0x1400008e3a0, 0x140000a5050, 0x140000ae468)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/context.go:63 +0x230
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:162 +0x63c
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/doc.go:77 +0x48
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc.func1()
        /bak/gomonkey/test/apply_method_func_test.go:47 +0x300
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/discovery.go:80 +0x2c
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:261 +0x208
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:110 +0x164
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/context.go:97 +0x4dc
  github.com/jtolds/gls.EnsureGoroutineId.func1()
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/gid.go:24 +0x38
  github.com/jtolds/gls._m(0x0, 0x140000ae120)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/stack_tags.go:108 +0x38
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x0, 0x140000ae120)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/stack_tags.go:56 +0x28
  github.com/jtolds/gls.addStackTag(0x0, 0x140000ae120)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/stack_tags.go:49 +0x30
  github.com/jtolds/gls.EnsureGoroutineId(0x140000a4630)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/gid.go:24 +0x150
  github.com/jtolds/gls.(*ContextManager).SetValues(0x1400008e3a0, 0x140000a45d0, 0x140000900a0)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/context.go:63 +0x230
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:105 +0x350
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/doc.go:75 +0x5c
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc(0x14000083860)
        /bak/gomonkey/test/apply_method_func_test.go:18 +0x1a0
  testing.tRunner(0x14000083860, 0x10515efd0)
        /.g/versions/1.18.10/src/testing/testing.go:1439 +0x178
  created by testing.(*T).Run
        /.g/versions/1.18.10/src/testing/testing.go:1486 +0x548
  

  * /bak/gomonkey/test/apply_method_func_test.go 
  Line 78:
  Expected: '<nil>'
  Actual:   'any'
  (Should be equal)
  goroutine 20 [running]:
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/reporting/reports.go:143 +0x50
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/reporting/reports.go:103 +0x98
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:176 +0x8c
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/doc.go:125 +0x58
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc.func1.4()
        /bak/gomonkey/test/apply_method_func_test.go:78 +0x350
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/discovery.go:80 +0x2c
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:261 +0x208
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:163 +0x60
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/context.go:97 +0x4dc
  github.com/jtolds/gls.EnsureGoroutineId(0x140000a53e0)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/gid.go:19 +0x58
  github.com/jtolds/gls.(*ContextManager).SetValues(0x1400008e3a0, 0x140000a5380, 0x140000ae5d0)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/context.go:63 +0x230
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:162 +0x63c
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/doc.go:77 +0x48
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc.func1()
        /bak/gomonkey/test/apply_method_func_test.go:66 +0x3f0
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/discovery.go:80 +0x2c
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:261 +0x208
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:110 +0x164
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/context.go:97 +0x4dc
  github.com/jtolds/gls.EnsureGoroutineId.func1()
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/gid.go:24 +0x38
  github.com/jtolds/gls._m(0x0, 0x140000ae120)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/stack_tags.go:108 +0x38
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x0, 0x140000ae120)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/stack_tags.go:56 +0x28
  github.com/jtolds/gls.addStackTag(0x0, 0x140000ae120)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/stack_tags.go:49 +0x30
  github.com/jtolds/gls.EnsureGoroutineId(0x140000a4630)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/gid.go:24 +0x150
  github.com/jtolds/gls.(*ContextManager).SetValues(0x1400008e3a0, 0x140000a45d0, 0x140000900a0)
        /go/pkg/mod/github.com/jtolds/gls@v4.20.0+incompatible/context.go:63 +0x230
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/context.go:105 +0x350
        /go/pkg/mod/github.com/smartystreets/goconvey@v1.6.4/convey/doc.go:75 +0x5c
  github.com/agiledragon/gomonkey/v2/test.TestApplyMethodFunc(0x14000083860)
        /bak/gomonkey/test/apply_method_func_test.go:18 +0x1a0
  testing.tRunner(0x14000083860, 0x10515efd0)
        /.g/versions/1.18.10/src/testing/testing.go:1439 +0x178
  created by testing.(*T).Run
        /.g/versions/1.18.10/src/testing/testing.go:1486 +0x548
  


15 total assertions

--- FAIL: TestApplyMethodFunc (0.00s)
FAIL
FAIL    github.com/agiledragon/gomonkey/v2/test 0.671s
FAIL

这只是启动一个单测,我建议在 github 上加上一个 CI 把,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions