-
-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
This is a weird one!
Raindrops 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:
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, "")
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels