Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
66dccb7f
Commit
66dccb7f
authored
Mar 27, 2019
by
Lucas Charles
Committed by
Evan Read
Mar 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update go guidelines, fix some minor typos
parent
81807d53
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
doc/development/go_guide/index.md
doc/development/go_guide/index.md
+2
-2
No files found.
doc/development/go_guide/index.md
View file @
66dccb7f
...
@@ -26,7 +26,7 @@ Reviewers and maintainers should pay attention to:
...
@@ -26,7 +26,7 @@ Reviewers and maintainers should pay attention to:
-
`defer`
functions: ensure the presence when needed, and after
`err`
check.
-
`defer`
functions: ensure the presence when needed, and after
`err`
check.
-
Inject dependencies as parameters.
-
Inject dependencies as parameters.
-
Void structs when marshal
l
ing to JSON (generates
`null`
instead of
`[]`
).
-
Void structs when marshaling to JSON (generates
`null`
instead of
`[]`
).
### Security
### Security
...
@@ -185,7 +185,7 @@ There are a few guidelines one should follow when using the
...
@@ -185,7 +185,7 @@ There are a few guidelines one should follow when using the
-
When printing an error use
-
When printing an error use
[
WithError
](
https://godoc.org/github.com/sirupsen/logrus#WithError
)
. For
[
WithError
](
https://godoc.org/github.com/sirupsen/logrus#WithError
)
. For
ex
ma
ple,
`logrus.WithError(err).Error("Failed to do something")`
.
ex
am
ple,
`logrus.WithError(err).Error("Failed to do something")`
.
-
Since we use
[
structured logging
](
#structured-json-logging
)
we can log
-
Since we use
[
structured logging
](
#structured-json-logging
)
we can log
fields in the context of that code path, such as the URI of the request using
fields in the context of that code path, such as the URI of the request using
[
`WithField`
](
https://godoc.org/github.com/sirupsen/logrus#WithField
)
or
[
`WithField`
](
https://godoc.org/github.com/sirupsen/logrus#WithField
)
or
...
...
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