-
Notifications
You must be signed in to change notification settings - Fork 95
enabled nonamedreturns linter #1033
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
base: master
Are you sure you want to change the base?
Changes from 4 commits
4cb8351
046768a
8094dd2
7ed5a33
fcc3a3f
5c3b04d
eba8f27
27069a2
b80e770
2a55b1e
a62169a
cf8ffa5
bc83353
7142fbc
e852c2f
1fac9de
74b12a2
ab2def6
68e1ee6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,12 @@ func episodeData(seriesID, seasonID, episodeID, title string, date time.Time) ty | |
) | ||
} | ||
|
||
func getData() (series, seasons, episodes []types.Value) { | ||
func getData() ([]types.Value, []types.Value, []types.Value) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Read comment for getDataForITCrowd There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. I returned previous declaration. |
||
var ( | ||
series = make([]types.Value, 0) | ||
seasons = make([]types.Value, 0) | ||
episodes = make([]types.Value, 0) | ||
) | ||
for seriesID, fill := range map[string]func(seriesID string) ( | ||
seriesData types.Value, seasons []types.Value, episodes []types.Value, | ||
){ | ||
|
@@ -61,15 +66,19 @@ func getData() (series, seasons, episodes []types.Value) { | |
episodes = append(episodes, episodesData...) | ||
} | ||
|
||
return | ||
return series, seasons, episodes | ||
} | ||
|
||
func getDataForITCrowd(seriesID string) (series types.Value, seasons, episodes []types.Value) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this changes not required and harmful There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. I returned previous declaration. |
||
series = seriesData( | ||
seriesID, date("2006-02-03"), "IT Crowd", ""+ | ||
"The IT Crowd is a British sitcom produced by Channel 4, written by Graham Linehan, produced by "+ | ||
"Ash Atalla and starring Chris O'Dowd, Richard Ayoade, Katherine Parkinson, and Matt Berry.", | ||
"", // NULL comment. | ||
func getDataForITCrowd(seriesID string) (types.Value, []types.Value, []types.Value) { | ||
var ( | ||
series = seriesData( | ||
seriesID, date("2006-02-03"), "IT Crowd", ""+ | ||
"The IT Crowd is a British sitcom produced by Channel 4, written by Graham Linehan, produced by "+ | ||
"Ash Atalla and starring Chris O'Dowd, Richard Ayoade, Katherine Parkinson, and Matt Berry.", | ||
"", // NULL comment. | ||
) | ||
seasons = make([]types.Value, 0) | ||
episodes = make([]types.Value, 0) | ||
) | ||
for _, season := range []struct { //nolint:gocritic | ||
title string | ||
|
@@ -120,12 +129,16 @@ func getDataForITCrowd(seriesID string) (series types.Value, seasons, episodes [ | |
return series, seasons, episodes | ||
} | ||
|
||
func getDataForSiliconValley(seriesID string) (series types.Value, seasons, episodes []types.Value) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Read previous comment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. I returned previous declaration. |
||
series = seriesData( | ||
seriesID, date("2014-04-06"), "Silicon Valley", ""+ | ||
"Silicon Valley is an American comedy television series created by Mike Judge, John Altschuler and "+ | ||
"Dave Krinsky. The series focuses on five young men who founded a startup company in Silicon Valley.", | ||
"Some comment here", | ||
func getDataForSiliconValley(seriesID string) (types.Value, []types.Value, []types.Value) { | ||
var ( | ||
series = seriesData( | ||
seriesID, date("2014-04-06"), "Silicon Valley", ""+ | ||
"Silicon Valley is an American comedy television series created by Mike Judge, John Altschuler and "+ | ||
"Dave Krinsky. The series focuses on five young men who founded a startup company in Silicon Valley.", | ||
"Some comment here", | ||
) | ||
seasons = make([]types.Value, 0) | ||
episodes = make([]types.Value, 0) | ||
) | ||
for _, season := range []struct { //nolint:gocritic | ||
title string | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can create a slice with predefined capacity
Because next line will re-allocate internal slice capacity
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively you can make slice from static
Such as
But on next step (
if secure
) append will re-allocate slice to new sizeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed this by adding the make with fixed capacity.