Linter configuration fixes and linting issues fixes.

Fixes #17.
This commit is contained in:
2020-02-29 22:41:06 +05:00
parent 11897d0e1a
commit 47672c586d
6 changed files with 17 additions and 9 deletions

View File

@@ -96,8 +96,7 @@ func (ff *FlatFiles) GetPagedPastes(page int) ([]structs.Paste, error) {
c.Logger.Debug().Msgf("%+v", publicPastes)
// Iteration two - get paginated pastes.
// nolint
var pastesData []structs.Paste
pastesData := make([]structs.Paste, 0)
for idx, paste := range publicPastes {
if len(pastesData) == c.Config.Pastes.Pagination {

View File

@@ -30,8 +30,14 @@ import (
)
func InitialUp(tx *sql.Tx) error {
// nolint
_, err := tx.Exec("CREATE TABLE `pastes` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Paste ID', `title` text NOT NULL COMMENT 'Paste title', `data` longtext NOT NULL COMMENT 'Paste data', `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Paste creation timestamp', `keep_for` int(4) NOT NULL DEFAULT 1 COMMENT 'Keep for integer. 0 - forever.', `keep_for_unit_type` int(1) NOT NULL DEFAULT 1 COMMENT 'Keep for unit type. 1 - minutes, 2 - hours, 3 - days, 4 - months.', PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='Pastes';")
_, err := tx.Exec(`CREATE TABLE pastes (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Paste ID',
title text NOT NULL COMMENT 'Paste title',
data longtext NOT NULL COMMENT 'Paste data',
created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Paste creation timestamp',
keep_for int(4) NOT NULL DEFAULT 1 COMMENT 'Keep for integer. 0 - forever.',
keep_for_unit_type int(1) NOT NULL DEFAULT 1 COMMENT 'Keep for unit type. 1 - minutes, 2 - hours, 3 - days, 4 - months.',
PRIMARY KEY (id), UNIQUE KEY id (id)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='Pastes';`)
if err != nil {
return err
}