From 004138c45a9f8951698c2ecdac3bcbf677b77ffc Mon Sep 17 00:00:00 2001 From: Anders Fylling Date: Fri, 16 Nov 2018 09:16:24 +0000 Subject: [PATCH] :art:updates import order --- auditlog.go | 3 ++- auditlog_test.go | 7 ++++--- cache.go | 3 ++- cache/benchmarks_test.go | 3 ++- channel.go | 3 ++- channel_test.go | 3 ++- client.go | 5 +++-- disgord.go | 3 ++- disgord_test.go | 5 +++-- emoji.go | 5 +++-- emoji_test.go | 9 +++++---- httd/json_std.go | 5 ++++- invite.go | 3 ++- message.go | 7 ++++--- reaction.go | 5 +++-- rest.go | 5 +++-- rest_channel.go | 3 ++- role.go | 3 ++- session.go | 3 ++- struct.go | 3 ++- struct_guild.go | 3 ++- struct_guild_test.go | 3 ++- user.go | 5 +++-- user_test.go | 3 ++- voice.go | 3 ++- voice_test.go | 7 ++++--- webhook.go | 3 ++- webhook_test.go | 3 ++- websocket/client.go | 11 ++++++----- websocket/client_test.go | 5 +++-- websocket/gateways.go | 5 +++-- websocket/packets.go | 3 ++- websocket/packets_test.go | 3 ++- websocket/websocket_gorilla.go | 5 +++-- 34 files changed, 92 insertions(+), 56 deletions(-) diff --git a/auditlog.go b/auditlog.go index 1e60ce08..da588485 100644 --- a/auditlog.go +++ b/auditlog.go @@ -1,12 +1,13 @@ package disgord import ( + "net/http" + "github.com/andersfylling/disgord/constant" "github.com/andersfylling/disgord/endpoint" "github.com/andersfylling/disgord/httd" "github.com/andersfylling/disgord/ratelimit" "github.com/andersfylling/snowflake/v3" - "net/http" ) // Audit-log event types diff --git a/auditlog_test.go b/auditlog_test.go index d8127b6b..6adc619c 100644 --- a/auditlog_test.go +++ b/auditlog_test.go @@ -2,13 +2,14 @@ package disgord import ( "errors" + "io/ioutil" + "net/http" + "testing" + "github.com/andersfylling/disgord/endpoint" "github.com/andersfylling/disgord/httd" "github.com/andersfylling/disgord/ratelimit" "github.com/andersfylling/snowflake/v3" - "io/ioutil" - "net/http" - "testing" ) func TestAuditLogConvertAuditLogParamsToStr(t *testing.T) { diff --git a/cache.go b/cache.go index af7257f5..779ba98e 100644 --- a/cache.go +++ b/cache.go @@ -2,9 +2,10 @@ package disgord import ( "errors" + "time" + "github.com/andersfylling/disgord/httd" "github.com/andersfylling/snowflake/v3" - "time" "github.com/andersfylling/disgord/cache/interfaces" "github.com/andersfylling/disgord/cache/lfu" diff --git a/cache/benchmarks_test.go b/cache/benchmarks_test.go index da28942f..d8a67185 100644 --- a/cache/benchmarks_test.go +++ b/cache/benchmarks_test.go @@ -1,10 +1,11 @@ package cache import ( + "testing" + "github.com/andersfylling/disgord/cache/interfaces" "github.com/andersfylling/disgord/cache/lfu" "github.com/andersfylling/disgord/cache/lru" - "testing" ) type Snowflake = interfaces.Snowflake diff --git a/channel.go b/channel.go index 249b62f4..8bcea3a5 100644 --- a/channel.go +++ b/channel.go @@ -2,9 +2,10 @@ package disgord import ( "errors" - "github.com/andersfylling/disgord/constant" "strconv" "time" + + "github.com/andersfylling/disgord/constant" ) // Channel types diff --git a/channel_test.go b/channel_test.go index f31d4b93..881eaf44 100644 --- a/channel_test.go +++ b/channel_test.go @@ -1,9 +1,10 @@ package disgord import ( - "github.com/andersfylling/disgord/httd" "io/ioutil" "testing" + + "github.com/andersfylling/disgord/httd" ) func TestChannel_InterfaceImplementations(t *testing.T) { diff --git a/client.go b/client.go index e47c0a8f..cbd8645d 100644 --- a/client.go +++ b/client.go @@ -4,8 +4,6 @@ import ( "context" "errors" "fmt" - "github.com/andersfylling/disgord/constant" - "github.com/andersfylling/disgord/websocket" "net/http" "os" "os/signal" @@ -14,6 +12,9 @@ import ( "syscall" "time" + "github.com/andersfylling/disgord/constant" + "github.com/andersfylling/disgord/websocket" + "github.com/andersfylling/disgord/event" "github.com/andersfylling/disgord/httd" "github.com/sirupsen/logrus" diff --git a/disgord.go b/disgord.go index 8c145bfe..b061e8b4 100644 --- a/disgord.go +++ b/disgord.go @@ -138,9 +138,10 @@ package disgord import ( "errors" + "strings" + "github.com/andersfylling/disgord/constant" "github.com/andersfylling/snowflake/v3" - "strings" ) // LibraryInfo returns name + version diff --git a/disgord_test.go b/disgord_test.go index 2ccf0380..e7a51588 100644 --- a/disgord_test.go +++ b/disgord_test.go @@ -1,13 +1,14 @@ package disgord import ( - "github.com/andersfylling/disgord/event" - "github.com/andersfylling/disgord/websocket" "net/http" "strconv" "sync" "testing" "time" + + "github.com/andersfylling/disgord/event" + "github.com/andersfylling/disgord/websocket" ) func TestValidateUsername(t *testing.T) { diff --git a/emoji.go b/emoji.go index b07206ac..582a384e 100644 --- a/emoji.go +++ b/emoji.go @@ -2,13 +2,14 @@ package disgord import ( "errors" + "net/http" + "strings" + "github.com/andersfylling/disgord/constant" "github.com/andersfylling/disgord/endpoint" "github.com/andersfylling/disgord/httd" "github.com/andersfylling/disgord/ratelimit" "github.com/andersfylling/snowflake/v3" - "net/http" - "strings" ) // Emoji ... diff --git a/emoji_test.go b/emoji_test.go index 177750a2..864ab7c4 100644 --- a/emoji_test.go +++ b/emoji_test.go @@ -1,15 +1,16 @@ package disgord import ( - "github.com/andersfylling/disgord/constant" - "github.com/andersfylling/disgord/endpoint" - "github.com/andersfylling/disgord/httd" - "github.com/andersfylling/disgord/ratelimit" "net/http" "os" "strings" "testing" "time" + + "github.com/andersfylling/disgord/constant" + "github.com/andersfylling/disgord/endpoint" + "github.com/andersfylling/disgord/httd" + "github.com/andersfylling/disgord/ratelimit" ) func TestEmoji_InterfaceImplementations(t *testing.T) { diff --git a/httd/json_std.go b/httd/json_std.go index 910dda22..454b5c6d 100644 --- a/httd/json_std.go +++ b/httd/json_std.go @@ -2,7 +2,10 @@ package httd -import "encoding/json" +import ( + "encoding/json" + "io" +) // Unmarshal is the json unmarshalling implementation that is defined by the used build tags. func Unmarshal(data []byte, v interface{}) error { diff --git a/invite.go b/invite.go index 90dbd594..23ea876a 100644 --- a/invite.go +++ b/invite.go @@ -1,11 +1,12 @@ package disgord import ( + "net/http" + "github.com/andersfylling/disgord/constant" "github.com/andersfylling/disgord/endpoint" "github.com/andersfylling/disgord/httd" "github.com/andersfylling/disgord/ratelimit" - "net/http" ) // PartialInvite ... diff --git a/message.go b/message.go index cdeb57f3..8fcb6664 100644 --- a/message.go +++ b/message.go @@ -4,15 +4,16 @@ import ( "bytes" "encoding/json" "errors" - "github.com/andersfylling/disgord/constant" - "github.com/andersfylling/disgord/endpoint" - "github.com/andersfylling/disgord/httd" "io" "mime/multipart" "net/http" "strconv" "sync" "time" + + "github.com/andersfylling/disgord/constant" + "github.com/andersfylling/disgord/endpoint" + "github.com/andersfylling/disgord/httd" ) // different message acticity types diff --git a/reaction.go b/reaction.go index 576e7439..5f4cc4a7 100644 --- a/reaction.go +++ b/reaction.go @@ -2,11 +2,12 @@ package disgord import ( "errors" + "net/http" + "strconv" + "github.com/andersfylling/disgord/constant" "github.com/andersfylling/disgord/endpoint" "github.com/andersfylling/disgord/httd" - "net/http" - "strconv" ) // Reaction ... diff --git a/rest.go b/rest.go index decb6297..ddf837d9 100644 --- a/rest.go +++ b/rest.go @@ -2,10 +2,11 @@ package disgord import ( "encoding/json" - "github.com/andersfylling/disgord/httd" - "github.com/andersfylling/snowflake/v3" "net/http" "strconv" + + "github.com/andersfylling/disgord/httd" + "github.com/andersfylling/snowflake/v3" ) type ErrRest = httd.ErrREST diff --git a/rest_channel.go b/rest_channel.go index 3c663a5c..56ccd176 100644 --- a/rest_channel.go +++ b/rest_channel.go @@ -3,9 +3,10 @@ package disgord import ( "encoding/json" "errors" + "net/http" + "github.com/andersfylling/disgord/endpoint" "github.com/andersfylling/disgord/httd" - "net/http" ) func ratelimitChannel(id Snowflake) string { diff --git a/role.go b/role.go index acb1fe44..9503d6ea 100644 --- a/role.go +++ b/role.go @@ -2,10 +2,11 @@ package disgord import ( "errors" + "net/http" + "github.com/andersfylling/disgord/constant" "github.com/andersfylling/disgord/endpoint" "github.com/andersfylling/disgord/httd" - "net/http" ) // NewRole ... diff --git a/session.go b/session.go index 47f74034..c7f4ef80 100644 --- a/session.go +++ b/session.go @@ -2,10 +2,11 @@ package disgord import ( "errors" - "github.com/andersfylling/disgord/event" "net/http" "time" + "github.com/andersfylling/disgord/event" + "github.com/andersfylling/disgord/constant" "github.com/andersfylling/disgord/httd" "github.com/andersfylling/disgord/websocket" diff --git a/struct.go b/struct.go index e81fbaec..1e5ce902 100644 --- a/struct.go +++ b/struct.go @@ -3,10 +3,11 @@ package disgord import ( "errors" "fmt" - "github.com/andersfylling/disgord/constant" "strconv" "sync" "time" + + "github.com/andersfylling/disgord/constant" ) // common functionality/types used by struct_*.go files goes here diff --git a/struct_guild.go b/struct_guild.go index f38ae275..5e6e8f85 100644 --- a/struct_guild.go +++ b/struct_guild.go @@ -3,8 +3,9 @@ package disgord import ( "encoding/json" "errors" - "github.com/andersfylling/disgord/constant" "sort" + + "github.com/andersfylling/disgord/constant" ) // consts inspired by: https://github.com/bwmarrin/discordgo/blob/master/structs.go diff --git a/struct_guild_test.go b/struct_guild_test.go index 414eff11..52eb44ad 100644 --- a/struct_guild_test.go +++ b/struct_guild_test.go @@ -2,9 +2,10 @@ package disgord import ( "encoding/json" - "github.com/andersfylling/disgord/httd" "io/ioutil" "testing" + + "github.com/andersfylling/disgord/httd" ) func TestGuild_InterfaceImplementations(t *testing.T) { diff --git a/user.go b/user.go index fd1da81a..f0f483e7 100644 --- a/user.go +++ b/user.go @@ -3,11 +3,12 @@ package disgord import ( "encoding/json" "errors" + "net/http" + "strconv" + "github.com/andersfylling/disgord/constant" "github.com/andersfylling/disgord/endpoint" "github.com/andersfylling/disgord/httd" - "net/http" - "strconv" ) const ( diff --git a/user_test.go b/user_test.go index bdc9ae85..b8dc35b6 100644 --- a/user_test.go +++ b/user_test.go @@ -2,9 +2,10 @@ package disgord import ( "fmt" - "github.com/andersfylling/disgord/httd" "io/ioutil" "testing" + + "github.com/andersfylling/disgord/httd" ) func TestUser_InterfaceImplementations(t *testing.T) { diff --git a/voice.go b/voice.go index a02076c9..5e06d5e3 100644 --- a/voice.go +++ b/voice.go @@ -1,11 +1,12 @@ package disgord import ( + "net/http" + "github.com/andersfylling/disgord/constant" "github.com/andersfylling/disgord/endpoint" "github.com/andersfylling/disgord/httd" "github.com/andersfylling/disgord/ratelimit" - "net/http" ) // VoiceState Voice State structure diff --git a/voice_test.go b/voice_test.go index c822e2b8..0c791666 100644 --- a/voice_test.go +++ b/voice_test.go @@ -1,12 +1,13 @@ package disgord import ( - "github.com/andersfylling/disgord/endpoint" - "github.com/andersfylling/disgord/httd" - "github.com/andersfylling/disgord/ratelimit" "io/ioutil" "net/http" "testing" + + "github.com/andersfylling/disgord/endpoint" + "github.com/andersfylling/disgord/httd" + "github.com/andersfylling/disgord/ratelimit" ) func TestStateMarshalling(t *testing.T) { diff --git a/webhook.go b/webhook.go index ebdb9bb5..0ae69c12 100644 --- a/webhook.go +++ b/webhook.go @@ -2,10 +2,11 @@ package disgord import ( "errors" + "net/http" + "github.com/andersfylling/disgord/constant" "github.com/andersfylling/disgord/endpoint" "github.com/andersfylling/disgord/httd" - "net/http" ) // Webhook Used to represent a webhook diff --git a/webhook_test.go b/webhook_test.go index 7ad8ad4d..956595f8 100644 --- a/webhook_test.go +++ b/webhook_test.go @@ -2,8 +2,9 @@ package disgord import ( "encoding/json" - "github.com/andersfylling/disgord/httd" "testing" + + "github.com/andersfylling/disgord/httd" ) func getJSONMap(v interface{}) (map[string]*json.RawMessage, error) { diff --git a/websocket/client.go b/websocket/client.go index eb7461b7..0285a783 100644 --- a/websocket/client.go +++ b/websocket/client.go @@ -3,17 +3,18 @@ package websocket import ( "errors" "fmt" - "github.com/andersfylling/disgord/httd" - "github.com/andersfylling/disgord/websocket/cmd" - "github.com/andersfylling/disgord/websocket/event" - "github.com/andersfylling/disgord/websocket/opcode" - "github.com/sirupsen/logrus" "math/rand" "net/http" "runtime" "strconv" "sync" "time" + + "github.com/andersfylling/disgord/httd" + "github.com/andersfylling/disgord/websocket/cmd" + "github.com/andersfylling/disgord/websocket/event" + "github.com/andersfylling/disgord/websocket/opcode" + "github.com/sirupsen/logrus" ) const ( diff --git a/websocket/client_test.go b/websocket/client_test.go index d3d458d3..3e6c092d 100644 --- a/websocket/client_test.go +++ b/websocket/client_test.go @@ -3,13 +3,14 @@ package websocket import ( "errors" "fmt" - "github.com/andersfylling/disgord/constant" - "github.com/andersfylling/disgord/websocket/opcode" "net/http" "strconv" "sync" "testing" "time" + + "github.com/andersfylling/disgord/constant" + "github.com/andersfylling/disgord/websocket/opcode" ) type testWS struct { diff --git a/websocket/gateways.go b/websocket/gateways.go index 746507b9..e33381e7 100644 --- a/websocket/gateways.go +++ b/websocket/gateways.go @@ -1,11 +1,12 @@ package websocket import ( - "github.com/andersfylling/disgord/endpoint" - "github.com/andersfylling/disgord/httd" "io/ioutil" "net/http" "strconv" + + "github.com/andersfylling/disgord/endpoint" + "github.com/andersfylling/disgord/httd" ) const ( diff --git a/websocket/packets.go b/websocket/packets.go index 05e337fc..fabcfeee 100644 --- a/websocket/packets.go +++ b/websocket/packets.go @@ -3,10 +3,11 @@ package websocket import ( "bytes" "compress/zlib" - "github.com/andersfylling/disgord/httd" "io" "strconv" "strings" + + "github.com/andersfylling/disgord/httd" ) // discordPacketJSON is used when we need to fall back on the unmarshaler logic diff --git a/websocket/packets_test.go b/websocket/packets_test.go index 023b5a9b..fd5e1bf9 100644 --- a/websocket/packets_test.go +++ b/websocket/packets_test.go @@ -1,10 +1,11 @@ package websocket import ( - "github.com/andersfylling/disgord/httd" "io/ioutil" "strconv" "testing" + + "github.com/andersfylling/disgord/httd" ) func getAllJSONFiles(t *testing.T) (files [][]byte) { diff --git a/websocket/websocket_gorilla.go b/websocket/websocket_gorilla.go index 9f4b9b18..c869f4c5 100644 --- a/websocket/websocket_gorilla.go +++ b/websocket/websocket_gorilla.go @@ -3,10 +3,11 @@ package websocket // TODO: if we add any other websocket packages, add build constraints to this file. import ( - "github.com/andersfylling/disgord/httd" - "github.com/gorilla/websocket" "io" "net/http" + + "github.com/andersfylling/disgord/httd" + "github.com/gorilla/websocket" ) func newConn(HTTPClient *http.Client) (Conn, error) {