diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index 0eace44..0000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Go - -on: [ push, pull_request ] - -jobs: - gobuild: - # We want to run on external PRs, but not on our own internal PRs as they'll be run - # by the push to the branch. - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.18 - - - name: go build - run: go build -v ./... - - govet: - # We want to run on external PRs, but not on our own internal PRs as they'll be run - # by the push to the branch. - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.18 - - - name: go vet - run: go vet -v ./... - - gotest: - # We want to run on external PRs, but not on our own internal PRs as they'll be run - # by the push to the branch. - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.18 - - - name: go test - env: - token: ${{ secrets.TOKEN }} - run: go test -v ./... - - gostaticcheck: - # We want to run on external PRs, but not on our own internal PRs as they'll be run - # by the push to the branch. - if: ${{ false }} # disable for now as staticcheck does not working with go 1.18 - # if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.18 - - - name: go staticcheck - uses: dominikh/staticcheck-action@v1.1.0 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..ecc07f3 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,26 @@ +name: Go + +on: [ push ] + +jobs: + gobuild: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v3 + with: + go-version: 1.18 + - uses: actions/checkout@v3 + - name: go build + run: go build -v ./... + + golangci: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v3 + with: + go-version: 1.18 + - uses: actions/checkout@v3 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest \ No newline at end of file diff --git a/_examples/id_token_example/example.go b/_examples/id_token_example/example.go index 429f6b9..6f02d4d 100644 --- a/_examples/id_token_example/example.go +++ b/_examples/id_token_example/example.go @@ -6,12 +6,12 @@ import ( "time" "github.com/disgoorg/dislog" - "github.com/disgoorg/snowflake" + "github.com/disgoorg/snowflake/v2" "github.com/sirupsen/logrus" ) var ( - webhookID = snowflake.Snowflake(os.Getenv("webhook_id")) + webhookID = snowflake.GetEnv("webhook_id") webhookToken = os.Getenv("webhook_token") ) diff --git a/_examples/webhook_client_example/example.go b/_examples/webhook_client_example/example.go index 34f7427..4d675da 100644 --- a/_examples/webhook_client_example/example.go +++ b/_examples/webhook_client_example/example.go @@ -8,14 +8,14 @@ import ( "github.com/disgoorg/disgo/rest" "github.com/disgoorg/disgo/webhook" - "github.com/disgoorg/snowflake" + "github.com/disgoorg/snowflake/v2" "github.com/disgoorg/dislog" "github.com/sirupsen/logrus" ) var ( - webhookID = snowflake.GetSnowflakeEnv("webhook_id") + webhookID = snowflake.GetEnv("webhook_id") webhookToken = os.Getenv("webhook_token") ) @@ -37,7 +37,7 @@ func main() { // Sets which logging levels to send to the webhook dislog.WithLogLevels(dislog.TraceLevelAndAbove...), // Sets a custom http client or nil for inbuilt - dislog.WithWebhookClient(webhook.NewClient(webhookID, webhookToken, webhook.WithRestClientConfigOpts(rest.WithHTTPClient(http.DefaultClient)))), + dislog.WithWebhookClient(webhook.New(webhookID, webhookToken, webhook.WithRestClientConfigOpts(rest.WithHTTPClient(http.DefaultClient)))), ) if err != nil { logger.Errorf("error initializing dislog %s", err) diff --git a/dislog.go b/dislog.go index 5e44cf4..6dd03fc 100644 --- a/dislog.go +++ b/dislog.go @@ -52,7 +52,7 @@ func New(opts ...ConfigOpt) (*DisLog, error) { config.Apply(opts) if config.WebhookID == 0 || config.WebhookToken == "" { - return nil, errors.New("Webhook ID & token or a webhook client are required") + return nil, errors.New("webhook ID & token or a webhook client are required") } return &DisLog{ diff --git a/go.mod b/go.mod index 6bd00b6..458a801 100644 --- a/go.mod +++ b/go.mod @@ -3,13 +3,14 @@ module github.com/disgoorg/dislog go 1.18 require ( - github.com/disgoorg/disgo v0.13.21 + github.com/disgoorg/disgo v0.14.0 github.com/disgoorg/log v1.2.0 github.com/disgoorg/snowflake/v2 v2.0.1 github.com/sirupsen/logrus v1.9.0 ) require ( + github.com/disgoorg/json v1.0.0 // indirect github.com/sasha-s/go-csync v0.0.0-20210812194225-61421b77c44b // indirect golang.org/x/sys v0.2.0 // indirect ) diff --git a/go.sum b/go.sum index 2615db3..ea99501 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,10 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/disgoorg/disgo v0.13.21 h1:mapasORJIZWGMcsAxTzosIHfBlx39g2KLbY/OJlJn3A= -github.com/disgoorg/disgo v0.13.21/go.mod h1:VpRp9ifKNcQ05mgIx9l5oU4TADysXUGmNx9iHM9/DpA= +github.com/disgoorg/disgo v0.14.0 h1:/m94GQbWREOI4wLiUf5XxHV/0BaJ2vZJmJe7xFWMJfk= +github.com/disgoorg/disgo v0.14.0/go.mod h1:YiVpXSmyXLRalYQHTHUFWEQvolCNzw0zh6nfug07b/M= +github.com/disgoorg/json v1.0.0 h1:kDhSM661fgIuNoZF3BO5/odaR5NSq80AWb937DH+Pdo= +github.com/disgoorg/json v1.0.0/go.mod h1:BHDwdde0rpQFDVsRLKhma6Y7fTbQKub/zdGO5O9NqqA= github.com/disgoorg/log v1.2.0 h1:sqlXnu/ZKAlIlHV9IO+dbMto7/hCQ474vlIdMWk8QKo= github.com/disgoorg/log v1.2.0/go.mod h1:3x1KDG6DI1CE2pDwi3qlwT3wlXpeHW/5rVay+1qDqOo= github.com/disgoorg/snowflake/v2 v2.0.1 h1:CuUxGLwggUxEswZOmZ+mZ5i0xSumQdXW9tXW7uGqe+0= @@ -14,11 +16,11 @@ github.com/sasha-s/go-csync v0.0.0-20210812194225-61421b77c44b/go.mod h1:/pA7k3z github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=