refactor(router): replace temporary variable pointer pattern with new() builtin
Simplify page number and chapter number pointer creation in reader route registration by using inline new() instead of local variable + address-of.
This commit is contained in:
@@ -123,14 +123,12 @@ func registerReaderRoutes(cfg *Config) {
|
||||
|
||||
var pageNumber *int
|
||||
if b.PageNumber.Valid {
|
||||
pn := int(b.PageNumber.Int32)
|
||||
pageNumber = &pn
|
||||
pageNumber = new(int(b.PageNumber.Int32))
|
||||
}
|
||||
|
||||
var chapterNumber *int
|
||||
if b.ChapterNumber.Valid {
|
||||
cn := int(b.ChapterNumber.Int32)
|
||||
chapterNumber = &cn
|
||||
chapterNumber = new(int(b.ChapterNumber.Int32))
|
||||
}
|
||||
|
||||
templateBookmarks[i] = templates.Bookmark{
|
||||
|
||||
Reference in New Issue
Block a user