Albirew/nyaa-pantsu
Albirew
/
nyaa-pantsu
Archivé
1
0
Bifurcation 0

Gofmt friendly (#752)

Keeping Go source code in line with what they preconize
Cette révision appartient à :
akuma06 2017-05-25 23:35:37 +02:00 révisé par ewhal
Parent 2da1c88c64
révision c3211c6a14
6 fichiers modifiés avec 38 ajouts et 41 suppressions

Voir le fichier

@ -47,4 +47,4 @@ var TorrentCleanCategories = map[string]string{
"1_": "software",
"1_1": "software_applications",
"1_2": "software_games",
}
}

Voir le fichier

@ -41,4 +41,3 @@ func (f *File) Filename() string {
path := f.Path()
return path[len(path)-1]
}

Voir le fichier

@ -14,11 +14,11 @@ import (
)
const (
TorrentStatusNormal = 1
TorrentStatusRemake = 2
TorrentStatusTrusted = 3
TorrentStatusAPlus = 4
TorrentStatusBlocked = 5
TorrentStatusNormal = 1
TorrentStatusRemake = 2
TorrentStatusTrusted = 3
TorrentStatusAPlus = 4
TorrentStatusBlocked = 5
)
type Feed struct {

Voir le fichier

@ -130,9 +130,9 @@ func getTorrentsOrderBy(parameters *serviceBase.WhereParams, orderBy string, lim
if !deleted {
conditionArray = append(conditionArray, "deleted_at IS NULL")
} else {
conditionArray = append(conditionArray, "deleted_at NOT NULL")
conditionArray = append(conditionArray, "deleted_at NOT NULL")
}
conditions := strings.Join(conditionArray, " AND ")
if countAll {
@ -225,7 +225,7 @@ func ToggleBlockTorrent(id string) (model.Torrent, int, error) {
if torrent.Status == model.TorrentStatusBlocked {
torrent.Status = model.TorrentStatusNormal
} else {
torrent.Status = model.TorrentStatusBlocked
torrent.Status = model.TorrentStatusBlocked
}
if db.ORM.Unscoped().Model(&torrent).UpdateColumn(&torrent).Error != nil {
return torrent, http.StatusInternalServerError, errors.New("Torrent was not updated.")
@ -244,4 +244,4 @@ func UpdateTorrent(torrent model.Torrent) (int, error) {
func GetDeletedTorrents(parameters *serviceBase.WhereParams, orderBy string, limit int, offset int) (torrents []model.Torrent, count int, err error) {
torrents, count, err = getTorrentsOrderBy(parameters, orderBy, limit, offset, true, true, true)
return
}
}

Voir le fichier

@ -1,17 +1,17 @@
package filelist;
package filelist
import (
"github.com/bradfitz/slice"
"github.com/NyaaPantsu/nyaa/model"
"html/template"
"bytes"
"strings"
"github.com/NyaaPantsu/nyaa/model"
"github.com/bradfitz/slice"
"html/template"
"strconv"
"strings"
)
type FileListFolder struct {
Folders map[string]*FileListFolder
Files []model.File
Files []model.File
}
func FileListToFolder(fileList []model.File) (out *FileListFolder) {
@ -27,10 +27,10 @@ func FileListToFolder(fileList []model.File) (out *FileListFolder) {
if len(pathArray) > 1 {
pathStrippedFile := model.File{
ID: file.ID,
TorrentID: file.TorrentID,
ID: file.ID,
TorrentID: file.TorrentID,
BencodedPath: "",
Filesize: file.Filesize,
Filesize: file.Filesize,
}
pathStrippedFile.SetPath(pathArray[1:])
pathsToFolders[pathArray[0]] = append(pathsToFolders[pathArray[0]], pathStrippedFile)
@ -59,19 +59,19 @@ func (f *FileListFolder) TotalSize() (out int64) {
}
type folderFormatData struct {
Data interface{}
FolderName string
TotalSize int64
NestLevel uint
Data interface{}
FolderName string
TotalSize int64
NestLevel uint
ParentIdentifier string
Identifier string
Identifier string
}
type fileFormatData struct {
Data interface{}
Filename string
Filesize int64
NestLevel uint
Data interface{}
Filename string
Filesize int64
NestLevel uint
ParentIdentifier string
}
@ -107,7 +107,7 @@ func (f *FileListFolder) makeFolderTreeView(folderTmpl *template.Template, fileT
}
output += tmp
tmp, err = folder.makeFolderTreeView(folderTmpl, fileTmpl, nestLevel + 1, childIdentifier, data)
tmp, err = folder.makeFolderTreeView(folderTmpl, fileTmpl, nestLevel+1, childIdentifier, data)
if err != nil {
return
}
@ -141,4 +141,3 @@ func (f *FileListFolder) MakeFolderTreeView(folderFormat string, fileFormat stri
output, err = f.makeFolderTreeView(folderTmpl, fileTmpl, 0, "root", data)
return
}

Voir le fichier

@ -1,9 +1,9 @@
package filelist;
package filelist
import (
"testing"
"html/template"
"github.com/NyaaPantsu/nyaa/model"
"html/template"
"testing"
)
func makeDummyFile(path ...string) (file model.File) {
@ -25,12 +25,12 @@ func TestFilelist(T *testing.T) {
makeDummyFile("A", "C", "C.txt"),
makeDummyFile("B.txt"),
}
expected := "A\n"+
"-B\n"+
"--C.txt\n"+
"-C\n"+
"--C.txt\n"+
"B.txt\n"
expected := "A\n" +
"-B\n" +
"--C.txt\n" +
"-C\n" +
"--C.txt\n" +
"B.txt\n"
filelist := FileListToFolder(files)
@ -46,4 +46,3 @@ func TestFilelist(T *testing.T) {
return
}
}