From 093b8537850575ef8de4f93c6d0227260f2b66a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nu=C8=9Biu?= Date: Sun, 29 Oct 2017 15:01:45 +0200 Subject: [PATCH] Fixing warnings --- server/server/commands.go | 2 +- server/server/errors.go | 15 +++++++-------- server/server/parser.go | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/server/server/commands.go b/server/server/commands.go index 1a182e7..dd1b963 100644 --- a/server/server/commands.go +++ b/server/server/commands.go @@ -86,7 +86,7 @@ func ListFiles(c net.Conn) error { } func ShowHelp(c net.Conn) error { - var helpText string = ` + var helpText = ` The available commands are: get - Download the requested filename. ls - List the files in the current directory. diff --git a/server/server/errors.go b/server/server/errors.go index fd3abe0..3144b40 100644 --- a/server/server/errors.go +++ b/server/server/errors.go @@ -14,15 +14,14 @@ func (e InputError) Error() string { return "Error: " + e.Op + ": " + e.Err.Erro // Input Errors var ( - InputUnknownError = errors.New("Unknown Error.") - InputInvalidCommand = errors.New("Invalid command.") - InputTooManyArguments = errors.New("Too many arguments.") - InputTooFewArguments = errors.New("Too few arguments.") + InputInvalidCommand = errors.New("invalid command") + InputTooManyArguments = errors.New("too many arguments") + InputTooFewArguments = errors.New("too few arguments") ) // Command Errors represent errors that occur when the server is executing commands var ( - GetNoBitsError = errors.New("The file/directory contains zero bits!") + GetNoBitsError = errors.New("the file/directory contains zero bits") ) type StackError struct { @@ -34,7 +33,7 @@ func (e StackError) Error() string { return e.ErrorName + ": " + e.Err.Error() } // Stack Errors var ( - StackInvalidTypeError = StackError{"InvalidTypeError", errors.New("Invalid item type for the Stack")} - StackOverflowError = StackError{"StackOverflowError", errors.New("Stack capacity exceeded!")} - StackUnderflowError = StackError{"StackUnderflowError", errors.New("Stack is empty!")} + StackInvalidTypeError = StackError{"InvalidTypeError", errors.New("invalid item type for the Stack")} + StackOverflowError = StackError{"StackOverflowError", errors.New("stack capacity exceeded")} + StackUnderflowError = StackError{"StackUnderflowError", errors.New("stack is empty")} ) diff --git a/server/server/parser.go b/server/server/parser.go index 1f898dc..5270ad2 100644 --- a/server/server/parser.go +++ b/server/server/parser.go @@ -59,7 +59,7 @@ func ProcessInput(c net.Conn, text string) error { // Ansi clear: 1b 5b 48 1b 5b 4a // clear | hexdump -C - var b []byte = []byte{0x1b, 0x5b, 0x48, 0x1b, 0x5b, 0x4a} + var b = []byte{0x1b, 0x5b, 0x48, 0x1b, 0x5b, 0x4a} c.Write(b) case "help":