Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-workhorse
Commits
b7204242
Commit
b7204242
authored
Sep 05, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set s.bytes only once
parent
5837c3fb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
internal/api/secret.go
internal/api/secret.go
+8
-4
No files found.
internal/api/secret.go
View file @
b7204242
...
...
@@ -33,6 +33,13 @@ func (s *Secret) getBytes() []byte {
}
func
(
s
*
Secret
)
setBytes
()
([]
byte
,
error
)
{
s
.
Lock
()
defer
s
.
Unlock
()
if
s
.
bytes
!=
nil
{
return
s
.
bytes
,
nil
}
base64Bytes
,
err
:=
ioutil
.
ReadFile
(
s
.
Path
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"read Secret.Path: %v"
,
err
)
...
...
@@ -48,9 +55,6 @@ func (s *Secret) setBytes() ([]byte, error) {
return
nil
,
fmt
.
Errorf
(
"expected %d secretBytes in %s, found %d"
,
numSecretBytes
,
s
.
Path
,
n
)
}
s
.
Lock
()
defer
s
.
Unlock
()
s
.
bytes
=
secretBytes
return
secretBytes
,
nil
return
s
.
bytes
,
nil
}
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