mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-26 10:36:23 -07:00
refactor: replace empty slice literal with var
An empty slice can be represented by `nil` or an empty slice literal. They are functionally equivalent — their `len` and `cap` are both zero — but the `nil` slice is the preferred style. For more information about empty slices, see [Declaring Empty Slices](https://github.com/golang/go/wiki/CodeReviewComments#declaring-empty-slices).
This commit is contained in:
parent
b066be86ed
commit
b457db6aa7
3 changed files with 5 additions and 3 deletions
|
@ -232,7 +232,7 @@ func getThreadPosts(thread *gcsql.Thread) ([]Post, error) {
|
|||
|
||||
func GetRecentPosts(boardid int, limit int) ([]Post, error) {
|
||||
query := postQueryBase
|
||||
args := []any{}
|
||||
var args []any
|
||||
|
||||
if boardid > 0 {
|
||||
query += " WHERE t.board_id = ?"
|
||||
|
|
|
@ -86,7 +86,8 @@ func RegisterManagePage(id string, title string, permissions int, jsonOutput int
|
|||
}
|
||||
|
||||
func getAvailableActions(rank int, noJSON bool) []Action {
|
||||
available := []Action{}
|
||||
var available []Action
|
||||
|
||||
for _, action := range actions {
|
||||
if (rank < action.Permissions || action.Permissions == NoPerms) ||
|
||||
(noJSON && action.JSONoutput == AlwaysJSON) {
|
||||
|
|
|
@ -23,7 +23,8 @@ func HandleReport(request *http.Request) error {
|
|||
if request.Method != "POST" {
|
||||
return ErrInvalidReport
|
||||
}
|
||||
reportedPosts := []int{}
|
||||
var reportedPosts []int
|
||||
|
||||
var id int
|
||||
if !gcsql.DoesBoardExistByDir(board) {
|
||||
return gcsql.ErrBoardDoesNotExist
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue