From 7a7a56d613f474e385fc1795f0e1f3106f3d56aa Mon Sep 17 00:00:00 2001 From: mavolin <48887425+mavolin@users.noreply.github.com> Date: Tue, 15 Dec 2020 16:40:08 +0100 Subject: [PATCH] State: remove redundant error return from NewFromSession --- state/state.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/state/state.go b/state/state.go index 9c48744..3c44d5c 100644 --- a/state/state.go +++ b/state/state.go @@ -110,7 +110,7 @@ func NewWithIntents(token string, intents ...gateway.Intents) (*State, error) { return nil, err } - return NewFromSession(s, defaultstore.New()) + return NewFromSession(s, defaultstore.New()), nil } func NewWithStore(token string, cabinet store.Cabinet) (*State, error) { @@ -119,12 +119,11 @@ func NewWithStore(token string, cabinet store.Cabinet) (*State, error) { return nil, err } - return NewFromSession(s, cabinet) + return NewFromSession(s, cabinet), nil } -// NewFromSession never returns an error. This API is kept for backwards -// compatibility. -func NewFromSession(s *session.Session, cabinet store.Cabinet) (*State, error) { +// NewFromSession creates a new State from the passed Session and Cabinet. +func NewFromSession(s *session.Session, cabinet store.Cabinet) *State { state := &State{ Session: s, Cabinet: cabinet, @@ -137,7 +136,7 @@ func NewFromSession(s *session.Session, cabinet store.Cabinet) (*State, error) { unreadyGuilds: moreatomic.NewGuildIDSet(), } state.hookSession() - return state, nil + return state } // WithContext returns a shallow copy of State with the context replaced in the