diff options
| author | Shulhan <ms@kilabit.info> | 2024-03-08 02:52:16 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-03-09 01:10:24 +0700 |
| commit | 29343294a596fd74f6f9cb917c8aac74ccb78094 (patch) | |
| tree | e9286ed53041b973cb6d767325034f30e504e1f5 /api | |
| parent | 4e35c509a41cecb207bf6f52e7c9a529fa9f71fb (diff) | |
| download | pakakeh.go-29343294a596fd74f6f9cb917c8aac74ccb78094.tar.xz | |
lib/http: refactoring NewServer and NewClient
The NewServer and NewClient now accept non-pointer options, so the
caller unable to modify the options once the server or client has
been created.
Diffstat (limited to 'api')
| -rw-r--r-- | api/slack/webhook_client.go | 2 | ||||
| -rw-r--r-- | api/telegram/bot/bot.go | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/api/slack/webhook_client.go b/api/slack/webhook_client.go index 4e7683db..5a749779 100644 --- a/api/slack/webhook_client.go +++ b/api/slack/webhook_client.go @@ -31,7 +31,7 @@ func NewWebhookClient(webhookURL, user, channel string) (wcl *WebhookClient, err return nil, fmt.Errorf("NewWebhookClient: %w", err) } - clientOpts := &libhttp.ClientOptions{ + var clientOpts = libhttp.ClientOptions{ ServerURL: fmt.Sprintf("%s://%s", wurl.Scheme, wurl.Host), } wcl = &WebhookClient{ diff --git a/api/telegram/bot/bot.go b/api/telegram/bot/bot.go index c87546b3..2ac3f0a0 100644 --- a/api/telegram/bot/bot.go +++ b/api/telegram/bot/bot.go @@ -110,7 +110,7 @@ func New(opts Options) (bot *Bot, err error) { return nil, fmt.Errorf("bot.New: %w", err) } - clientOpts := &http.ClientOptions{ + var clientOpts = http.ClientOptions{ ServerURL: defURL + opts.Token + `/`, } bot = &Bot{ @@ -365,7 +365,7 @@ func (bot *Bot) startWebhook() (err error) { // createServer start the HTTP server for receiving Update. func (bot *Bot) createServer() (err error) { - serverOpts := &http.ServerOptions{ + var serverOpts = http.ServerOptions{ Address: bot.opts.Webhook.ListenAddress, } |
