Skip to content

Commit

Permalink
fix: upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
karl-cardenas-coding committed Nov 17, 2024
1 parent 34742d8 commit b2c4304
Show file tree
Hide file tree
Showing 13 changed files with 71 additions and 67 deletions.
49 changes: 25 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO_VERSION: '1.23'

jobs:

Expand All @@ -17,12 +18,12 @@ jobs:
steps:

- name: "Check out code into the Go module directory"
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
cache: 'npm'

- name: "Get dependencies"
Expand All @@ -44,19 +45,19 @@ jobs:
GOOS: darwin
steps:
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: ${{ env.GO_VERSION }}
check-latest: true
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@v4

-
name: create
run: go build -ldflags="-X 'github.com/karl-cardenas-coding/disaster-cli/cmd.VersionString=${{needs.next-version.outputs.version}}'" -o=disaster -v && zip disaster-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip disaster
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: disaster-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip
path: disaster-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip
Expand All @@ -71,18 +72,18 @@ jobs:
GOOS: darwin
steps:
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: ${{ env.GO_VERSION }}
check-latest: true
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: create
run: go build -ldflags="-X 'github.com/karl-cardenas-coding/disaster-cli/cmd.VersionString=${{needs.next-version.outputs.version}}'" -o=disaster -v && zip disaster-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip disaster
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: disaster-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip
path: disaster-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip
Expand All @@ -97,19 +98,19 @@ jobs:
GOOS: linux
steps:
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: ${{ env.GO_VERSION }}
check-latest: true
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@v4

-
name: create
run: go build -ldflags="-X 'github.com/karl-cardenas-coding/disaster-cli/cmd.VersionString=${{needs.next-version.outputs.version}}'" -o=disaster -v && zip disaster-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip disaster
- uses: actions/upload-artifact@v1
- uses: actions/checkout@v4
with:
name: disaster-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip
path: disaster-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip
Expand All @@ -124,19 +125,19 @@ jobs:
GOOS: linux
steps:
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: ${{ env.GO_VERSION }}
check-latest: true
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@v4

-
name: create
run: go build -ldflags="-X 'github.com/karl-cardenas-coding/disaster-cli/cmd.VersionString=v${{needs.next-version.outputs.version}}'" -o=disaster -v && zip disaster-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip disaster
- uses: actions/upload-artifact@v1
- uses: actions/checkout@v4
with:
name: disaster-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip
path: disaster-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip
Expand All @@ -152,19 +153,19 @@ jobs:
GOOS: windows
steps:
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: ${{ env.GO_VERSION }}
check-latest: true
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@v4

-
name: create
run: go build -ldflags="-X 'github.com/karl-cardenas-coding/disaster-cli/cmd.VersionString=${{needs.next-version.outputs.version}}'" -o=disaster.exe -v && zip disaster-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip disaster.exe
- uses: actions/upload-artifact@v1
- uses: actions/checkout@v4
with:
name: disaster-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip
path: disaster-v${{needs.next-version.outputs.version}}-${{env.GOOS}}-${{env.GOARCH}}.zip
Expand All @@ -175,7 +176,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/download-artifact@v1
with:
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ on:
branches: [ main ]
env:
GITHUB_TOKEN: ${{ github.token }}
LINT_VERSION: "1.53.3"
LINT_VERSION: "1.62.0"
GO_VERSION: '1.23'

jobs:
test:
Expand All @@ -16,19 +17,19 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: ${{ env.GO_VERSION }}
check-latest: true
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Go Tests
run: |
go get && go test ./...
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
args: -v

Expand All @@ -40,12 +41,12 @@ jobs:
steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: ${{ env.GO_VERSION }}
check-latest: true
id: go

Expand Down Expand Up @@ -83,7 +84,7 @@ jobs:
chmod +x disaster
./disaster version
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: test-results
path: go.txt
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ license:

opensource:
@echo "Checking for open source licenses"
~/go/bin/go-licenses report github.com/karl-cardenas-coding/disaster-cli --template=documentation/open-source.tpl > documentation/open-source.md
~/go/bin/go-licenses report github.com/karl-cardenas-coding/disaster-cli --template=documentation/open-source.tpl > documentation/open-source.md


tests:
@echo "Running tests..."
go test -v ./...
2 changes: 1 addition & 1 deletion cmd/categories.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"os"

"github.com/jedib0t/go-pretty/v6/table"
"github.com/karl-cardenas-coding/disaster-cli/library"
library "github.com/karl-cardenas-coding/disaster-cli/internal"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"os"

"github.com/jedib0t/go-pretty/v6/table"
"github.com/karl-cardenas-coding/disaster-cli/library"
library "github.com/karl-cardenas-coding/disaster-cli/internal"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand Down
3 changes: 1 addition & 2 deletions cmd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
log "github.com/sirupsen/logrus"

"github.com/dustin/go-humanize"
"github.com/karl-cardenas-coding/disaster-cli/library"
library "github.com/karl-cardenas-coding/disaster-cli/internal"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -230,7 +230,6 @@ func determineOS() string {
return output
}

//
// https://golangcode.com/download-a-file-with-progress/
// WriteCounter counts the number of bytes written to it. It implements to the io.Writer interface
// and we can pass this into io.TeeReader() which will report progress on each write cycle.
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
module github.com/karl-cardenas-coding/disaster-cli

go 1.20
go 1.23

require (
github.com/dustin/go-humanize v1.0.1
github.com/jedib0t/go-pretty/v6 v6.4.6
github.com/jedib0t/go-pretty/v6 v6.6.1
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.7.0
github.com/spf13/cobra v1.8.1
)

require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/sys v0.27.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
13 changes: 13 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc=
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
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=
Expand All @@ -9,15 +12,21 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jedib0t/go-pretty/v6 v6.4.6 h1:v6aG9h6Uby3IusSSEjHaZNXpHFhzqMmjXcPq1Rjl9Jw=
github.com/jedib0t/go-pretty/v6 v6.4.6/go.mod h1:Ndk3ase2CkQbXLLNf5QDHoYb6J9WtVfmHZu9n8rk2xs=
github.com/jedib0t/go-pretty/v6 v6.6.1 h1:iJ65Xjb680rHcikRj6DSIbzCex2huitmc7bDtxYVWyc=
github.com/jedib0t/go-pretty/v6 v6.6.1/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/pkg/profile v1.6.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
Expand All @@ -26,6 +35,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand All @@ -40,6 +51,8 @@ golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
18 changes: 6 additions & 12 deletions library/client.go → internal/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package library
import (
"encoding/json"
"net/http"
"time"

log "github.com/sirupsen/logrus"
)
Expand All @@ -15,17 +14,6 @@ const (
ISSUE_MSG = " Please open up a Github issue to report this error! https://github.com/karl-cardenas-coding/disaster-cli"
)

var disasterClient = &http.Client{
Timeout: 10 * time.Second,
Transport: &http.Transport{
MaxIdleConns: 10,
ResponseHeaderTimeout: 10 * time.Second,
IdleConnTimeout: 5 * time.Second,
DisableCompression: true,
ForceAttemptHTTP2: true,
},
}

func getJson(url string, target interface{}) error {
req, err := http.NewRequest("GET", url, nil)
if err != nil {
Expand All @@ -38,6 +26,12 @@ func getJson(url string, target interface{}) error {
"Accept": []string{"application/json"},
}

disasterClient := &http.Client{
Transport: &http.Transport{
ForceAttemptHTTP2: true,
},
}

r, err := disasterClient.Do(req)
if err != nil {
log.WithFields(log.Fields{
Expand Down
Loading

0 comments on commit b2c4304

Please sign in to comment.