Skip to content

Commit 8aae853

Browse files
committed
fix
1 parent 996c91d commit 8aae853

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

inn/models.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ func GenerateCheckSums(innType INNType, nums []int) CheckSums {
105105
nums = append(nums, f(nums))
106106
}
107107

108-
fmt.Println(nums[len(nums)+shiftIdx:])
109108
return nums[len(nums)+shiftIdx:]
110109
}
111110

ogrn/models.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,15 @@ const (
167167
)
168168

169169
func ParseOGRN(requiredType OGRNType, ogrn string) (*OGRNStruct, error) {
170-
if ((requiredType == Legal || requiredType == Government) && len(ogrn) != legalLength) ||
171-
(requiredType == Physical && len(ogrn) != physicalLength) {
170+
if requiredType != Physical && len(ogrn) != legalLength {
171+
return nil, &models.CommonError{
172+
Method: packageName,
173+
Err: models.ErrInvalidLength,
174+
}
175+
}
176+
177+
if requiredType == Physical && len(ogrn) != physicalLength {
178+
fmt.Println(requiredType, len(ogrn))
172179
return nil, &models.CommonError{
173180
Method: packageName,
174181
Err: models.ErrInvalidLength,
@@ -277,7 +284,6 @@ func (o *OGRNStruct) makeSliceInts() []int {
277284

278285
utils.FillSlice(o.yearsNumbers.Ints(), res, 2)
279286
utils.FillSlice(o.region.Ints(), res, 4)
280-
fmt.Println("fillSlice", o.serialNumbers.Ints(), res)
281287
utils.FillSlice(o.serialNumbers.Ints(), res, n-2)
282288

283289
return res

ogrnip/ogrnip.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
// Validate check to valid OGRNIP format
1010
// example: input format is 304500116000157
1111
func Validate(ogrnip string) (bool, error) {
12-
ogrnData, err := ogrn.ParseOGRN(ogrn.Legal, ogrnip)
12+
ogrnData, err := ogrn.ParseOGRN(ogrn.Physical, ogrnip)
1313
if err != nil {
1414
return false, fmt.Errorf("parse %s model: %w", packageName, err)
1515
}

utils/helpers.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ func Random(min, max int) int {
3131

3232
randomNumber, err := rand.Int(rand.Reader, big.NewInt(int64(max-min+1)))
3333
if err != nil {
34-
fmt.Println("Error generating random number:", err)
35-
return 0
34+
panic(fmt.Errorf("generate random number: %w", err))
3635
}
3736

3837
return int(randomNumber.Int64()) + min

0 commit comments

Comments
 (0)