exercism / exercism/exalysis

Valid solution fails to compile under Exalysis

Open
#82 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

[Solution 17070203b36548d8aa7b2cd0e1c24802](https://exercism.io/mentor/solutions/17070203b36548d8aa7b2cd0e1c24802) compiles and passes tests when you run `go test` in the solution, but running Exalysis gives a compilation failure:

```
go test
PASS
ok _/Users/john/git/bitfield/exercism/users/ksimon1/go/robot-name 0.006s

exalysis

Hi there!

This looks very good!

Could you have a look at the following point so I can approve the solution?
- Unfortunately, this solution does not compile correctly. Did you run the tests? Maybe you accidentally submitted an incomplete solution? If you're having trouble getting your program to compile, you can always ask me for help!
```

Here's the source:

```go
//Package robotname implements functions for creating robot
package robotname

import (
"fmt"
"math/rand"
"time"
)

//Robot hold informations about robot
type Robot struct {
name string
}

var robotNamesList = make(map[string]bool)

const (
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
//26 letters - len(11010) == 5
letterIDBits = 5
//binary masK 11111
letterIDMask = 1<= 0 {
//if we exhaust 63 bit random number, create new one
if remain == 0 {
cache, remain = rand.Int63(), maxLettersMask
}
//if bitwise AND operation is in interval
if id := int(cache & letterIDMask); id < len(letters) {
//save new letter
b[i] = letters[id]
i--
}
//shift random number
cache >>= letterIDBits
remain--
}
//calculate if we can still use old random number
remain = (remain * letterIDBits) % numbersIDBits
i = numberOfNumbers - 1

for i >= 0 {
//if we exhaust 63 bit random number, create new one
if remain == 0 {
cache, remain = rand.Int63(), maxNumbersMask
}
//if bitwise AND operation is in interval
if id := int(cache & numberIDMask); id < len(numbers) {
//save new letter
b[i+2] = numbers[id]
i--
}
//shift random number
cache >>= letterIDBits
remain--
}

return string(b)
}
```

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.