Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Issue with retrieving enums from a list #31

Closed
mikeogezi opened this issue Dec 2, 2023 · 1 comment
Closed

Issue with retrieving enums from a list #31

mikeogezi opened this issue Dec 2, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@mikeogezi
Copy link
Contributor

Describe the bug
I run into a panic when I try to use an enum that I retrieved from a list as an argument.

To Reproduce

@list = list("Device Name", "Device Hostname")
@name = getListItem(list, 0)
@hostname = getListItem(list, 1)
@val = getDeviceDetail(hostname)
alert(val)

Debug output
Parsing custom actions... ### CUSTOM ACTIONS ###

done!
Parsing test.cherri...
panic: interface conversion: interface {} is main.action, not string

goroutine 1 [running]:
main.checkEnum({{0x100d76fac, 0x6}, {0x100d766ce, 0x4}, {0x100d7ad07, 0xe}, {0x0, 0x0}, {0x1400007e3c0, 0xa, ...}, ...}, ...)
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231201134025-7ca10989beb1/action.go:268 +0x210
main.checkArg(0x14000165468, 0x14000165378)
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231201134025-7ca10989beb1/action.go:396 +0xac
main.collectArgument(0x100dc8ca0?, 0x14000165468, 0x14000010640?)
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231201134025-7ca10989beb1/parser.go:413 +0x2dc
main.collectArguments()
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231201134025-7ca10989beb1/parser.go:380 +0x12c
main.collectAction()
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231201134025-7ca10989beb1/parser.go:1185 +0x220
main.collectValue(0x140001657b0, 0x140001657c0, 0xa)
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231201134025-7ca10989beb1/parser.go:307 +0x4e4
main.collectVariableValue(0x0, 0x140001657b0, 0x140001657c0, 0x140001657f0, 0x140001657e0)
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231201134025-7ca10989beb1/parser.go:240 +0x3c
main.collectVariable(0x0)
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231201134025-7ca10989beb1/parser.go:485 +0x6e8
main.parse()
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231201134025-7ca10989beb1/parser.go:147 +0x480
main.initParse()
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231201134025-7ca10989beb1/parser.go:49 +0x2f4
main.main()
/Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231201134025-7ca10989beb1/main.go:75 +0x35c

Expected behavior
I expect the retrieved enum to work as an argument.

Screenshots
N/A

Version Information (please complete the following information):

  • macOS version (run uname -a): Darwin Michaels-MacBook-Air.local 23.2.0 Darwin Kernel Version 23.2.0: Fri Oct 13 09:28:08 PDT 2023; root:xnu-10002.60.54~14/RELEASE_ARM64_T8112 arm64
  • Golang version (run go version): go version go1.21.4 darwin/arm64

Additional context
N/A

@mikeogezi mikeogezi added the bug Something isn't working label Dec 2, 2023
@mikeogezi mikeogezi changed the title Issue with getting enums from a list Issue with retrieving enums from a list Dec 2, 2023
@electrikmilk electrikmilk self-assigned this Dec 2, 2023
@electrikmilk
Copy link
Owner

Thank you for pointing this out!

It appears that if it gets a value of an argument to check against an enum it forces it to be a string. I will fix it to check if the type of value we get is or evaluates to a variable and if so, skip the check as we can't know the output of an action at this time.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants