Skip to content

Commit

Permalink
Fixed linters
Browse files Browse the repository at this point in the history
  • Loading branch information
mymmrac committed Jul 14, 2022
1 parent e4da733 commit 6168e2b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ linters:
- ireturn # Accept Interfaces, Return Concrete Types
- maligned # Tool to detect Go structs that would take less memory if their fields were sorted
- nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity
- noctx # noctx finds sending http request without context.Context
- nonamedreturns # Reports all named returns
- paralleltest # paralleltest detects missing usage of t.Parallel() method in your Go test
- scopelint # Scopelint checks for unpinned variables in go programs
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ func main() {
botToken := os.Getenv("TOKEN")

// Create bot and enable debugging info
// (more on configuration at /examples/configuration/main.go)
// Note: Please keep in mind that default logger may expose sensitive information,
// use in development only
// (more on configuration at examples/configuration/main.go)
bot, err := telego.NewBot(botToken, telego.WithDefaultLogger(true, true))
if err != nil {
fmt.Println(err)
Expand Down Expand Up @@ -158,7 +158,7 @@ func main() {
}

// Get updates channel
// (more on configuration at /examples/updates_long_pulling/main.go)
// (more on configuration at examples/updates_long_pulling/main.go)
updates, _ := bot.UpdatesViaLongPulling(nil)

// Stop reviving updates from updates channel
Expand Down Expand Up @@ -205,7 +205,7 @@ func main() {

// Get updates channel from webhook.
// Note: For one bot only one webhook allowed.
// (more on configuration at /examples/updates_webhook/main.go)
// (more on configuration at examples/updates_webhook/main.go)
updates, _ := bot.UpdatesViaWebhook("/bot" + bot.Token())

// Start server for receiving requests from Telegram
Expand Down Expand Up @@ -271,9 +271,9 @@ func main() {
// Retrieve chat ID
chatID := update.Message.Chat.ID

// Call method sendMessage
// (https://core.telegram.org/bots/api#sendmessage).
// Call method sendMessage.
// Sends message to sender with same text (echo bot).
// (https://core.telegram.org/bots/api#sendmessage)
sentMessage, _ := bot.SendMessage(
tu.Message(
tu.ID(chatID),
Expand Down Expand Up @@ -339,7 +339,7 @@ import (
)

func main() {
// ... initializing bot (full example in /examples/keyboard/main.go)
// ... initializing bot (full example in examples/keyboard/main.go)

// Creating keyboard
keyboard := tu.Keyboard(
Expand Down Expand Up @@ -472,7 +472,7 @@ import (

func main() {
// ... initializing bot and bot handler
// (full example in /examples/handler_specific/main.go)
// (full example in examples/handler_specific/main.go)

// Register new handler with match on command `/start`
bh.HandleMessage(func(bot *telego.Bot, message telego.Message) {
Expand Down
2 changes: 2 additions & 0 deletions helpers_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,15 @@ func TestBot_UpdatesViaWebhook(t *testing.T) {
resp, errHTTP := http.Post(fmt.Sprintf("http://%s", addr), telegoapi.ContentTypeJSON,
bytes.NewBuffer([]byte{}))
assert.NoError(t, errHTTP)
assert.NoError(t, resp.Body.Close())

require.NotNil(t, resp)
assert.Equal(t, http.StatusBadRequest, resp.StatusCode)

resp, errHTTP = http.Post(fmt.Sprintf("http://%s", addr), telegoapi.ContentTypeJSON,
bytes.NewBuffer(expectedUpdateBytes))
assert.NoError(t, errHTTP)
assert.NoError(t, resp.Body.Close())

require.NotNil(t, resp)
assert.Equal(t, http.StatusOK, resp.StatusCode)
Expand Down

0 comments on commit 6168e2b

Please sign in to comment.