exercism / exercism/exalysis

raindrops: panic: interface conversion: astrav.Node is *astrav.CallExpr, not *astrav.FuncDecl

Open
#83 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
33
Forks
13
PR merge metrics
No merged PRs in 30d

Description

This is a weird one!

[Raindrops 8c8e0e3527c545289d89772cf235efe2](https://exercism.io/mentor/solutions/8c8e0e3527c545289d89772cf235efe2) gives this result:

```
I know the "raindrops" exercise, so I'll try to make some specific suggestions about it, as well as the general code checks:
go test: OK
go test -race: SKIPPED
golint: OK
gofmt: OK
go vet: OK
golangci-lint: FAIL
raindrops.go:9:6: `main` is unused (deadcode)
func main() {
^

benchmarks: SKIPPED
panic: interface conversion: astrav.Node is *astrav.CallExpr, not *astrav.FuncDecl

goroutine 1 [running]:
github.com/tehsphinx/exalysis/track/raindrops.examExtensiveForLoop(0xc0000be000, 0xc0002de300)
/Users/john/git/bitfield/exalysis/track/raindrops/raindrops.go:105 +0x605
github.com/tehsphinx/exalysis/track/raindrops.Suggest(0xc0000be000, 0xc0002de300)
/Users/john/git/bitfield/exalysis/track/raindrops/raindrops.go:15 +0x5d
github.com/tehsphinx/exalysis.GetSuggestions(0xc000476180, 0x3b, 0xc0002d7ea0, 0x1, 0x1, 0x4e)
/Users/john/git/bitfield/exalysis/suggestion.go:66 +0x54f
main.watchClipboard()
/Users/john/git/bitfield/exalysis/cmd/exalysis/main.go:64 +0x23e
main.main()
/Users/john/git/bitfield/exalysis/cmd/exalysis/main.go:31 +0x26a
```

Here's the code:

```go
package raindrops

import (
"fmt"
"strconv"
"strings"
)

func main() {
var number int
fmt.Println("Enter number: ")
fmt.Scan(&number)
fmt.Println(number)

fmt.Println("Result: ")
fmt.Println(Convert(number))
}

//Convert number
func Convert(i int) string {
bStr := []string{}

if i%3 == 0 {
bStr = append(bStr, "Pling")
}

if i%5 == 0 {
bStr = append(bStr, "Plang")
}
if i%7 == 0 {
bStr = append(bStr, "Plong")
}

if i%3 != 0 && i%5 != 0 && i%7 != 0 {
bStr = append(bStr, strconv.Itoa(i))
}

return strings.Join(bStr, "")
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.