Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
dex
Commits
217e2669
Commit
217e2669
authored
Jan 09, 2016
by
bobbyrullo
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #259 from ericchiang/secret_errors
pkg: improve base64 flag error message
parents
f9fc8763
248337b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
base64.go
pkg/flag/base64.go
+7
-3
No files found.
pkg/flag/base64.go
View file @
217e2669
...
@@ -31,7 +31,7 @@ func (f *Base64) Set(s string) error {
...
@@ -31,7 +31,7 @@ func (f *Base64) Set(s string) error {
}
}
if
len
(
b
)
!=
f
.
len
{
if
len
(
b
)
!=
f
.
len
{
return
fmt
.
Errorf
(
"expected %d-byte secret
"
,
f
.
len
)
return
fmt
.
Errorf
(
"expected %d-byte secret
, got %d-byte secret"
,
f
.
len
,
len
(
b
)
)
}
}
f
.
val
=
b
f
.
val
=
b
...
@@ -62,11 +62,15 @@ func (f *Base64List) Set(ss string) error {
...
@@ -62,11 +62,15 @@ func (f *Base64List) Set(ss string) error {
if
ss
==
""
{
if
ss
==
""
{
return
nil
return
nil
}
}
for
i
,
s
:=
range
strings
.
Split
(
ss
,
","
)
{
splits
:=
strings
.
Split
(
ss
,
","
)
for
i
,
s
:=
range
splits
{
b64
:=
NewBase64
(
f
.
len
)
b64
:=
NewBase64
(
f
.
len
)
err
:=
b64
.
Set
(
s
)
err
:=
b64
.
Set
(
s
)
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error decoding string %d: %q"
,
i
,
err
)
if
len
(
splits
)
==
1
{
return
err
}
return
fmt
.
Errorf
(
"error decoding string %d: %v"
,
i
,
err
)
}
}
f
.
val
=
append
(
f
.
val
,
b64
.
Bytes
())
f
.
val
=
append
(
f
.
val
,
b64
.
Bytes
())
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment