Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various changes regarding code readibility #523

Merged
merged 5 commits into from
Feb 2, 2019
Merged

Various changes regarding code readibility #523

merged 5 commits into from
Feb 2, 2019

Conversation

shuLhan
Copy link
Contributor

@shuLhan shuLhan commented Jan 30, 2019

Changes:

07f0c88 (Shulhan, 2 hours ago)
all: simplify variable initialization

If we assign the variable after declaring it, we can simplify it using
":=" operator or "= value". The reader can still known the type of variable
from the struct name or variable type before assignment operator.

7e00ec6 (Shulhan, 2 hours ago)
args: simplify if-condition check on boolean value

cf6c51e (Shulhan, 2 hours ago)
http_test: simplify strings.Index with strings.Contains

Both have the same O(n), but strings.Contains more readable on
if-condition.

8439088 (Shulhan, 2 hours ago)
all: replace string(bytes.Buffer.Bytes()) with bytes.Buffer.String()

Although its only occured on test files, it may be worth to simplified it.

5f1f929 (Shulhan, 2 hours ago)
all: use sort.Strings when applicable

Basically, sort.Strings is the shortcut of Sort(StringSlice(a)) but its
more readable.

Basically, sort.Strings is the shortcut of Sort(StringSlice(a)) but its
more readable.
Although its only occured on test files, it may be worth to simplified it.
Both have the same O(n), but strings.Contains more readable on
if-condition.
If we assign the variable after declaring it, we can simplify it using
":=" operator or "= value".
The reader can still known the type of variable from the struct name or
variable type before assignment operator.
@erikdubbelboer erikdubbelboer merged commit 9574c37 into valyala:master Feb 2, 2019
@erikdubbelboer
Copy link
Collaborator

Thanks.

@shuLhan shuLhan deleted the lint-gosimple branch February 3, 2019 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants