From 894bc6617cb6cd3a79695aa2d30fd99b80446aa0 Mon Sep 17 00:00:00 2001 From: Anatoly Prohacky Date: Sat, 4 Mar 2023 16:58:02 +1000 Subject: [PATCH] change v0.0.1 --- acl/aclbit.go | 7 ++----- go.mod | 3 ++- go.sum | 1 + main.go | 5 ++--- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/acl/aclbit.go b/acl/aclbit.go index 80d6be8..e928a15 100644 --- a/acl/aclbit.go +++ b/acl/aclbit.go @@ -73,11 +73,8 @@ func (a AclBit) String() string { // converting string bits to int64 func (a AclBit) Int64() int64 { - i64, err := strconv.ParseInt(a.String(), 2, 64) - if err != nil { - return -1 - } - return i64 + return int64(a) + } // converting string bits to int64 diff --git a/go.mod b/go.mod index 4220b70..fa54583 100644 --- a/go.mod +++ b/go.mod @@ -2,9 +2,10 @@ module gitstore.ru/tolikproh/policy go 1.18 +require github.com/stretchr/testify v1.8.0 + require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/stretchr/testify v1.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index b410979..5164829 100644 --- a/go.sum +++ b/go.sum @@ -8,6 +8,7 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/main.go b/main.go index 0195b3f..31e5429 100644 --- a/main.go +++ b/main.go @@ -9,9 +9,8 @@ import ( func main() { a := acl.New(63, 63, 63, 3, 62, 62, 64, 64, 5654, 5435, -12234) fmt.Println(a) - str := acl.String(a) - fmt.Println(str) - fmt.Println(acl.Int64(str)) + fmt.Println(a.String()) + fmt.Println(a.Int64()) b := fmt.Sprintf("%b", a) fmt.Println(b) fmt.Println(acl.Verify(a, 63))