Skip to content

Commit

Permalink
go fmt + gci
Browse files Browse the repository at this point in the history
Signed-off-by: Cléo Rebert <[email protected]>
  • Loading branch information
constantoine authored and diamondburned committed Sep 19, 2023
1 parent d36955a commit 8f548d2
Show file tree
Hide file tree
Showing 32 changed files with 46 additions and 56 deletions.
2 changes: 1 addition & 1 deletion 0-examples/voice/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"errors"
"flag"
"log"
"os"
Expand All @@ -16,7 +17,6 @@ import (
"github.com/diamondburned/arikawa/v3/voice"
"github.com/diamondburned/arikawa/v3/voice/udp"
"github.com/diamondburned/oggreader"
"errors"
)

func main() {
Expand Down
1 change: 1 addition & 0 deletions api/cmdroute/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmdroute

import (
"fmt"

"github.com/diamondburned/arikawa/v3/api"
"github.com/diamondburned/arikawa/v3/discord"
)
Expand Down
2 changes: 1 addition & 1 deletion api/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package api
import (
"bytes"
"encoding/base64"
"errors"
"fmt"
"net/http"

"errors"
"github.com/diamondburned/arikawa/v3/utils/json"
)

Expand Down
3 changes: 2 additions & 1 deletion api/interaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package api

import (
"fmt"
"mime/multipart"

"github.com/diamondburned/arikawa/v3/discord"
"github.com/diamondburned/arikawa/v3/utils/json/option"
"github.com/diamondburned/arikawa/v3/utils/sendpart"
"mime/multipart"
)

var EndpointInteractions = Endpoint + "interactions/"
Expand Down
3 changes: 2 additions & 1 deletion api/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package api

import (
"fmt"
"mime/multipart"

"github.com/diamondburned/arikawa/v3/discord"
"github.com/diamondburned/arikawa/v3/internal/intmath"
"github.com/diamondburned/arikawa/v3/utils/httputil"
"github.com/diamondburned/arikawa/v3/utils/json/option"
"github.com/diamondburned/arikawa/v3/utils/sendpart"
"mime/multipart"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion api/rate/rate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package rate

import (
"context"
"errors"
"fmt"
"net/http"
"strconv"
Expand All @@ -10,7 +11,6 @@ import (
"sync/atomic"
"time"

"errors"
"github.com/diamondburned/arikawa/v3/internal/moreatomic"
)

Expand Down
2 changes: 1 addition & 1 deletion api/webhook/interactionserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"crypto/ed25519"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"

"errors"
"github.com/diamondburned/arikawa/v3/api"
"github.com/diamondburned/arikawa/v3/discord"
)
Expand Down
3 changes: 1 addition & 2 deletions api/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ package webhook

import (
"context"
"errors"
"fmt"
"mime/multipart"
"net/url"
"regexp"
"strconv"

"errors"

"github.com/diamondburned/arikawa/v3/api"
"github.com/diamondburned/arikawa/v3/api/rate"
"github.com/diamondburned/arikawa/v3/discord"
Expand Down
15 changes: 7 additions & 8 deletions arikawa.go
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
// Package arikawa contains a set of modular packages that allows you to make a
// Discord bot or any type of session (OAuth unsupported).
//
// Session
// # Session
//
// Package session is the most simple abstraction, which combines the API
// package and the Gateway websocket package together into one. This could be
// used for minimal bots that only use gateway events and such.
//
// State
// # State
//
// Package state abstracts on top of session and provides a local cache of API
// calls and events. Bots that either don't need a command router or already has
// its own should use this package.
//
// Bot
// # Bot
//
// Package bot abstracts on top of state and provides a command router based on
// Go code. This is similar to discord.py's API, only it's Go and there's no
// optional arguments (yet, although it could be worked around). Most bots are
// recommended to use this package, as it's the easiest way to make a bot.
//
// Voice
// # Voice
//
// Package voice provides an abstraction on top of State and adds voice support.
// This allows bots to join voice channels and talk. The package uses an
Expand All @@ -29,12 +29,11 @@
package arikawa

import (
// Low level packages.
_ "github.com/diamondburned/arikawa/v3/api"
_ "github.com/diamondburned/arikawa/v3/gateway"
// Packages that most should use.
_ "github.com/diamondburned/arikawa/v3/session"
_ "github.com/diamondburned/arikawa/v3/state"
_ "github.com/diamondburned/arikawa/v3/voice"

// Low level packages.
_ "github.com/diamondburned/arikawa/v3/api"
_ "github.com/diamondburned/arikawa/v3/gateway"
)
2 changes: 1 addition & 1 deletion discord/interaction.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package discord

import (
"errors"
"fmt"
"reflect"
"strings"

"errors"
"github.com/diamondburned/arikawa/v3/internal/rfutil"
"github.com/diamondburned/arikawa/v3/utils/json"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/testenv/testenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
package testenv

import (
"errors"
"fmt"
"os"
"strconv"
"sync"
"testing"
"time"

"errors"
"github.com/diamondburned/arikawa/v3/discord"
)

Expand Down
3 changes: 1 addition & 2 deletions internal/zlib/zlib.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ package zlib

import (
"bytes"
"errors"
"fmt"
"log"

"errors"
)

var Suffix = [4]byte{'\x00', '\x00', '\xff', '\xff'}
Expand Down
3 changes: 1 addition & 2 deletions session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ package session

import (
"context"
"errors"
"fmt"
"log"
"sync"

"errors"

"github.com/diamondburned/arikawa/v3/api"
"github.com/diamondburned/arikawa/v3/api/webhook"
"github.com/diamondburned/arikawa/v3/gateway"
Expand Down
3 changes: 1 addition & 2 deletions state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package state

import (
"context"
"errors"
"fmt"
"sync"

Expand All @@ -15,8 +16,6 @@ import (
"github.com/diamondburned/arikawa/v3/state/store"
"github.com/diamondburned/arikawa/v3/state/store/defaultstore"
"github.com/diamondburned/arikawa/v3/utils/handler"

"errors"
)

var (
Expand Down
6 changes: 3 additions & 3 deletions state/store/store.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Package store contains interfaces of the state's storage and its
// implementations.
//
// Getter Methods
// # Getter Methods
//
// All getter methods will be wrapped by the State. If the State can't find
// anything in the storage, it will call the API itself and automatically add
Expand All @@ -15,7 +15,7 @@
// Getter methods should not care about returning slices in order, unless
// explicitly stated against.
//
// ErrNotFound Rules
// # ErrNotFound Rules
//
// If a getter method cannot find something, it should return ErrNotFound.
// Callers including State may check if the error is ErrNotFound to do something
Expand All @@ -27,7 +27,7 @@
// ErrNotFound when either happens. This will make State refetch from the API,
// so it is not ideal.
//
// Remove Methods
// # Remove Methods
//
// Remove methods should return a nil error if the item it wants to delete is
// not found. This helps save some additional work in some cases.
Expand Down
4 changes: 2 additions & 2 deletions utils/bot/_example/advanced_bot/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"strings"
"time"

"github.com/diamondburned/arikawa/v3/discord"
"github.com/diamondburned/arikawa/v3/gateway"
"github.com/diamondburned/arikawa/v3/utils/bot"
"github.com/diamondburned/arikawa/v3/utils/bot/extras/arguments"
"github.com/diamondburned/arikawa/v3/utils/bot/extras/middlewares"
"github.com/diamondburned/arikawa/v3/discord"
"github.com/diamondburned/arikawa/v3/gateway"
)

type Bot struct {
Expand Down
2 changes: 1 addition & 1 deletion utils/bot/_example/advanced_bot/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"runtime"
"strings"

"github.com/diamondburned/arikawa/v3/gateway"
"github.com/diamondburned/arikawa/v3/utils/bot"
"github.com/diamondburned/arikawa/v3/utils/bot/extras/middlewares"
"github.com/diamondburned/arikawa/v3/gateway"
)

// Flag for administrators only.
Expand Down
3 changes: 1 addition & 2 deletions utils/bot/ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package bot

import (
"context"
"errors"
"fmt"
"log"
"os"
Expand All @@ -11,8 +12,6 @@ import (
"syscall"
"time"

"errors"

"github.com/diamondburned/arikawa/v3/api"
"github.com/diamondburned/arikawa/v3/gateway"
"github.com/diamondburned/arikawa/v3/session"
Expand Down
2 changes: 1 addition & 1 deletion utils/bot/ctx_call.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package bot

import (
"errors"
"reflect"
"strings"

"github.com/diamondburned/arikawa/v3/api"
"github.com/diamondburned/arikawa/v3/discord"
"github.com/diamondburned/arikawa/v3/gateway"
"github.com/diamondburned/arikawa/v3/utils/json/option"
"errors"
)

// Break is a non-fatal error that could be returned from middlewares to stop
Expand Down
2 changes: 1 addition & 1 deletion utils/bot/extras/middlewares/middlewares.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package middlewares

import (
"github.com/diamondburned/arikawa/v3/discord"
"github.com/diamondburned/arikawa/v3/utils/bot"
"github.com/diamondburned/arikawa/v3/utils/bot/extras/infer"
"github.com/diamondburned/arikawa/v3/discord"
)

func AdminOnly(ctx *bot.Context) func(interface{}) error {
Expand Down
3 changes: 1 addition & 2 deletions utils/bot/subcommand.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package bot

import (
"errors"
"fmt"
"reflect"
"runtime"
"strings"

"errors"

"github.com/diamondburned/arikawa/v3/gateway"
)

Expand Down
3 changes: 1 addition & 2 deletions utils/cmd/genevent/genevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"bytes"
_ "embed"
"flag"
"fmt"
"go/format"
Expand All @@ -12,8 +13,6 @@ import (
"strings"
"text/template"
"unicode"

_ "embed"
)

var (
Expand Down
3 changes: 1 addition & 2 deletions utils/cmd/gensnowflake/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ package main

import (
"bytes"
_ "embed"
"flag"
"go/format"
"log"
"os"
"path/filepath"
"text/template"

_ "embed"
)

type data struct {
Expand Down
3 changes: 1 addition & 2 deletions utils/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ package handler

import (
"context"
"errors"
"fmt"
"reflect"
"sync"

"errors"
)

// Handler is a container for command handlers. A zero-value instance is a valid
Expand Down
Loading

0 comments on commit 8f548d2

Please sign in to comment.