1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-24 05:17:03 +00:00

formatting

Former-commit-id: 037081db5d6d4434e873ca8b75334ee43e046b6a
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-08-17 10:06:20 +03:00
parent 00967408dc
commit 07046ab978
112 changed files with 477 additions and 517 deletions

View File

@@ -375,5 +375,4 @@ func getTopicConsumeSSEHandler(ctx iris.Context) {
flusher.Flush()
}
}
}

View File

@@ -32,7 +32,6 @@ type uploadedFiles struct {
}
func scanUploads(dir string) *uploadedFiles {
f := new(uploadedFiles)
lindex := dir[len(dir)-1]
@@ -54,7 +53,6 @@ func scanUploads(dir string) *uploadedFiles {
func (f *uploadedFiles) scan(dir string) {
f.dir = dir
filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
// if it's directory or a thumbnail we saved earlier, skip it.
if info.IsDir() || strings.HasPrefix(info.Name(), "thumbnail_") {
return nil
@@ -117,7 +115,6 @@ func (f *uploadedFiles) createThumbnail(uf uploadedFile) {
png.Encode(out, resized)
}
// and so on... you got the point, this code can be simplify, as a practise.
}
func main() {
@@ -152,7 +149,6 @@ func main() {
// assuming that you have a folder named 'uploads'
out, err := os.OpenFile(uploadsDir+fname,
os.O_WRONLY|os.O_CREATE, 0666)
if err != nil {
ctx.StatusCode(iris.StatusInternalServerError)
ctx.Application().Logger().Warnf("Error while preparing the new file: %v", err.Error())

View File

@@ -26,7 +26,7 @@ import (
const version = "0.0.1"
func init() {
var envFileName = ".env"
envFileName := ".env"
flagset := flag.CommandLine
flagset.StringVar(&envFileName, "env", envFileName, "the env file which web app will use to extract its environment variables")

View File

@@ -99,7 +99,6 @@ func newApp(db *DB) *iris.Application {
ctx.ViewData("FORM_RESULT",
template.HTML("<pre><a target='_new' href='"+shortenURL+"'>"+shortenURL+" </a></pre>"))
}
}
}

View File

@@ -73,5 +73,4 @@ func TestURLShortener(t *testing.T) {
}
time.Sleep(1 * time.Second)
}

View File

@@ -20,9 +20,7 @@ type Store interface {
Close() // release the store or ignore
}
var (
tableURLs = []byte("urls")
)
var tableURLs = []byte("urls")
// DB representation of a Store.
// Only one table/bucket which contains the urls, so it's not a fully Database,
@@ -44,7 +42,7 @@ func openDatabase(stumb string) *bolt.DB {
}
// create the buckets here
var tables = [...][]byte{
tables := [...][]byte{
tableURLs,
}
@@ -160,7 +158,6 @@ func (d *DB) GetByValue(value string) (keys []string) {
// Len returns all the "shorted" urls length
func (d *DB) Len() (num int) {
d.db.View(func(tx *bolt.Tx) error {
// Assume bucket exists and has keys
b := tx.Bucket(tableURLs)
if b == nil {