Gofmt friendly (#752)
Keeping Go source code in line with what they preconize
Cette révision appartient à :
Parent
2da1c88c64
révision
c3211c6a14
6 fichiers modifiés avec 38 ajouts et 41 suppressions
|
@ -41,4 +41,3 @@ func (f *File) Filename() string {
|
|||
path := f.Path()
|
||||
return path[len(path)-1]
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Référencer dans un nouveau ticket